RE: Which is better?
Hi, M. Lewis [EMAIL PROTECTED] asked: Charles K. Clarkson recently replied to Sreedhar Reddy in which one of the corrections he made was: open my $fh, '', $input_file or die qq(Cannot open $input_file: $!); [...] When I have opened a file, I have always done: open (FILE, $file) || die Cannot open $file :$!; A couple of things different. - I use a FILEHANDLE, where Charles used a variable. Passing a filehandle to a subroutine is possible, but if you use IO::Handle objects like Charles, it's much easier. - Charles explicitly said the file was being opened for reading. My understanding is that is the default. I assume that Charles did this for clarity. Security, too. In Charles' case, all the open ever does is try to open a file. In your case, it could be used to do almost anything. That's fine as long as your code runs on your box only, probably with a fixed my $file = ... right above it - but just imagine your code if part of a CGI program and $file is a CGI parameter, and somebody set it to '/bin/rm -rf /|'. - Charles opted to use qq() which cause him to have to enclose the $input_file in . Dead wrong. He used qq() so that he did not have to quote the inside a string which he wanted to be interpolated. Delimiting arguments in an error message by quotes is a very good idea because it lets you see leading or trailing whitespace which you'd otherwise miss. My question is, which way is better, and why is it better? My assumption is Charles' method is better, but I would appreciate knowing why. HTH, Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Which is better?
Thanks Thomas. Appreciated. Thomas Bätzler wrote: Hi, M. Lewis [EMAIL PROTECTED] asked: Charles K. Clarkson recently replied to Sreedhar Reddy in which one of the corrections he made was: open my $fh, '', $input_file or die qq(Cannot open $input_file: $!); [...] When I have opened a file, I have always done: open (FILE, $file) || die Cannot open $file :$!; A couple of things different. - I use a FILEHANDLE, where Charles used a variable. Passing a filehandle to a subroutine is possible, but if you use IO::Handle objects like Charles, it's much easier. - Charles explicitly said the file was being opened for reading. My understanding is that is the default. I assume that Charles did this for clarity. Security, too. In Charles' case, all the open ever does is try to open a file. In your case, it could be used to do almost anything. That's fine as long as your code runs on your box only, probably with a fixed my $file = ... right above it - but just imagine your code if part of a CGI program and $file is a CGI parameter, and somebody set it to '/bin/rm -rf /|'. I rarely do CGI stuff so this really isn't really in my realm, although I can see how via your example, it would be a good idea to make that a habit. - Charles opted to use qq() which cause him to have to enclose the $input_file in . Dead wrong. He used qq() so that he did not have to quote the inside a string which he wanted to be interpolated. Delimiting arguments in an error message by quotes is a very good idea because it lets you see leading or trailing whitespace which you'd otherwise miss. You've lost me here Thomas. Again, his code was: open my $fh, '', $input_file or die qq(Cannot open $input_file: $!); What am I missing here? My question is, which way is better, and why is it better? My assumption is Charles' method is better, but I would appreciate knowing why. HTH, Thomas -- Those who can't write, write help files. 01:40:01 up 10:03, 3 users, load average: 0.12, 0.18, 0.16 Linux Registered User #241685 http://counter.li.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Which is better?
M. Lewis wrote: Charles K. Clarkson recently replied to Sreedhar Reddy in which one of the corrections he made was: open my $fh, '', $input_file or die qq(Cannot open $input_file: $!); It seems that Charles' habits are to prevent excess typing and to 'be lean on variables' as he phrased it I believe. When I have opened a file, I have always done: open (FILE, $file) || die Cannot open $file :$!; A couple of things different. - I use a FILEHANDLE, where Charles used a variable. Charles used a *lexical* variable so that the scope of the variable is limited and the filehandle is automatically closed when the variable goes out of scope while FILEHANDLE is a package variable that is more globally visible. - Charles explicitly said the file was being opened for reading. My understanding is that is the default. Yes, you could even write it simply as: $FILE = 'somefile.txt'; open( FILE ) || die Cannot open $FILE :$!; But that won't work if $FILE is a lexical variable. I assume that Charles did this for clarity. And for safety. perldoc -q How can I open a file - Charles opted to use qq() which cause him to have to enclose the $input_file in . Perl has several forms of quoting but he didn't have to enclose $input_file in . The following are equivalent: die qq(Cannot open $input_file: $!); die Cannot open \$input_file\: $!; die Cannot open \042$input_file\042: $!; die 'Cannot open ', $input_file, ': ', $!; die 'Cannot open ' . $input_file . ': ' . $!; Or he could enclose $input_file in single quotes: die Cannot open '$input_file': $!; My question is, which way is better, and why is it better? The safest way is usually better. :-) John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Which is better?
Hi, M. Lewis [EMAIL PROTECTED] asked: You've lost me here Thomas. Again, his code was: open my $fh, '', $input_file or die qq(Cannot open $input_file: $!); What am I missing here? Charles wants to output an error message like Cannot open somefilename: No such file or directory at somescript line xx. The part behind the colon is the error message in $!. The naive way to construct this print would be to write print 'Cannot open' . $input_file . ':' . $!; This is horrible, since Perl can interpolate variable names in strings quoted using double quotes. However, if you want to use the double quote character inside of such a string, you have to escape that character in order to distinguish it from a string ending quote: print Cannot open \$input_file\: $!; This is where the qq() operator comes in. It basically acts like a double quote for its contents, without actually using that character - so you can now have a string that can be interpolated but in which the doubles quotes do not have to be escaped: print qq(Look Ma! No backslash!); And if you wanted to use round brackets inside your string, you could use a different set of delimiters, like so: print qq/Again, no escape character required for ()/; See the perlop manpage for details, and qq's useful relatives q, qr and qw. HTH, Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Alcatel CORBA 5620 OSS
Hi all, We have an Alcatel CORBA 5620 gateway from which we have extract information. Does anyone know of a module that would enable Perl to access this service? I searched the CPAN's archive but could not find anything. Apologies if this is the wrong list to ask - which would be the best list? Thanks, Tielman ~~ This e-mail and its contents are subject to the Telkom SA Limited e-mail legal notice available at http://www.telkom.co.za/TelkomEMailLegalNotice.PDF ~~
Re: Which is better?
John W. Krahn wrote: M. Lewis wrote: I assume that Charles did this for clarity. And for safety. perldoc -q How can I open a file Also you should read through the open tutorial and the I/O Operators section of the perlop.pod document. perldoc perlopentut perldoc perlop John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Which is better?
M. Lewis mailto:[EMAIL PROTECTED] wrote: : open my $fh, '', $input_file or die qq(Cannot open $input_file: $!); [snip] : Charles opted to use qq() which cause him to have to enclose the : $input_file in . $input_file is in quotes just in case I tried to open a file that has leading or trailing spaces in the name. I once wrote a script which opened a number of files and I couldn't figure out why one file was not opening. (It was early morning, as I recall.) After adding the quotes I found stray white space in the name. (I think I was splitting white space with split /\s/; instead of split ' '; and the leading space on the first argument was left on.) Here's a very simple example. In my directory in.txt exists, but not in.txt. (Note: I used warn here to get all the error messages. Normally we die on fatal errors.) #!/usr/bin/perl use strict; use warnings; #use diagnostics; my $file = ' in.txt'; open my $fh, '', $file or warn qq(Cannot open $file: $!); close $fh or warn qq(Cannot close $file: $!); warn \n; open $fh, '', $file or warn qq(Cannot open $file: $!); close $fh or warn qq(Cannot close $file: $!); __END__ Cannot open in.txt: No such file or directory at bb.pl line 9. Cannot close in.txt: Bad file descriptor at bb.pl line 11. Cannot open in.txt: No such file or directory at bb.pl line 13. Cannot close in.txt: Bad file descriptor at bb.pl line 15. At the end of a long programming night, in the early morning hours, as the text on the screen seems to be moving, the first set of errors made debugging easier. You may be surprised how many times I have tested example code for an answer on this list and found this. :) Cannot open : No such file or directory at . . . The quotes around the file name are not needed for interpolation. (The qq() operator does that.) They just aid me in picking up extra white space and have saved me some debugging time in the past. I wrap the hole message in qq() because escaped quotes '\' look so ugly (to me). HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Perldoc question...
I'm really new to PERL, and have what's probably a really basic question I've seen references to perldoc where apparently a person can look and find explanations of various PERL topics...but where do I go to find PERLDOC? Is this a website or ??? Thank you for help and suggestions. Apathy is on the increase, but who cares?. Imagine if there were no hypothetical questions Portions of this message may be confidential under an exemption to Ohio's public records law or under a legal privilege. If you have received this message in error or due to an unauthorized transmission or interception, please delete all copies from your system without disclosing, copying, or transmitting this message.
Re: Perldoc question...
From: [EMAIL PROTECTED] I'm really new to PERL, and have what's probably a really basic question I've seen references to perldoc where apparently a person can look and find explanations of various PERL topics...but where do I go to find PERLDOC? Is this a website or ??? perldoc is a program included in the perl package. Just run the commands: perldoc perldoc perldoc perl And you will see how you should use it. This program is in the same directory with the perl executable (bin). Teddy -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Perldoc question...
Octavian Rasnita mailto:[EMAIL PROTECTED] wrote: : perldoc is a program included in the perl package. : : Just run the commands: : : perldoc perldoc : perldoc perl You can run the commands from a dos (or command prompt) window on a Windows type machine. : And you will see how you should use it. : : This program is in the same directory with the perl : executable (bin). HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
ssh and sudo not working together....
Greetings, I have a perl script that is using telnet that I need to switch to SSH and I'm having some issues. First is I need to use sudo to run the command on the server I'm connecting to and second I need to run more then one command, I'll then save all this output. I have this so far but it is not allowing sudo, just wondering if it is NET::SSH or that RSA type of SSH we are running? I have tried to pass numerous commands but that doesn't seem to work, how can I run numerous commands via the single SSH connection? #!/usr/bin/perl use Net::SSH qw(sshopen2); use strict; my $user = ops; my $host = prserver07a; my $cmd = ls -al; my $cmd2 = sudo opcagt; sshopen2 ([EMAIL PROTECTED], *READER, *WRITER, $cmd2) || die ssh: $!; while (READER) { chomp(); print $_\n; } close (READER); close (WRITER); Thanks Bill
Re: Thank you for your answer. And yesterday i was write from Nahid`s email address
Hello. I send you example. And that example i will try what i want to ask. This is a file is info.xml and it constraint below info Personal NAMEUlfet/NAME SURNAMETANRIVERDIYEV/SURNAME AGE24/AGE ADDRESSBAKU/ADDRESS /Personal Education SCHOOLXetai 191/SCHOOL UNIVERSITYQafqaz University/UNIVERSITY /Education /info So, i wrote script in PERL. And it is below #* #!/usr/bin/perl open(FILE,info.xml) or xeta(File can not open...); @b = FILE; close(FILE); $search = ''; @results = grep(/$search/,@b); print @results\n; #* And have a other script and its below #* #!/usr/bin/perl -w use XML::Simple; my $infile = 'info.xml'; my $xml = XMLin(); print XMLout($xml), \n; #* So, i need to get that information from indo.xml (Ulfet, Tanriverdiyev, 24, Baku,) I want to get without tags information. I read that in PERL has a module which can read files(XML) and get from information whitout tags. Please help me, how can i get. I wrote script which can find and get ftom file that information without XML tags. Thank you very much in advance
RE: Perldoc question...
On Mon, 17 Oct 2005, Charles K. Clarkson wrote: Octavian Rasnita mailto:[EMAIL PROTECTED] wrote: : perldoc is a program included in the perl package. : : Just run the commands: : : perldoc perldoc : perldoc perl You can run the commands from a dos (or command prompt) window on a Windows type machine. Much of the same material is also available on the web, at sites such as http://perldoc.perl.org/ You can also find a lot of the same material on the CPAN site, along with the module itself. Do a search on search on http://search.cpan.org/ for the module you're interested in and you should be able to turn up module-specific perldoc reference material. You may find reading the material this way, in a web browser, nicely formatted, with varying colors, fonts, etc, more convenient and comfortable than reading it in a DOS / *nix terminal window. -- Chris Devers D3Y¸«ñmá -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Which is better?
On Mon, 17 Oct 2005 00:54:28 -0500, M. Lewis wrote: Charles K. Clarkson recently replied to Sreedhar Reddy in which one of the corrections he made was: open my $fh, '', $input_file or die qq(Cannot open $input_file: $!); [...] When I have opened a file, I have always done: open (FILE, $file) || die Cannot open $file :$!; [...] My question is, which way is better, and why is it better? My assumption is Charles' method is better, but I would appreciate knowing why. Charles' method is also better because he doesn't have to remember to put the parentheses around the arguments to open(). You have used the higher precedence || operator which means that your program would have a nasty bug without those parentheses. I use 'or' and 'and' for all operations where a control flow change is intended, and || and only where computing an expression is intended. -- Peter Scott http://www.perlmedic.com/ http://www.perldebugged.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Thank you for your answer. And yesterday i was write from Nahid`s email address
On 10/17/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: This is a file is info.xml and it constraint below info Personal NAMEUlfet/NAME SURNAMETANRIVERDIYEV/SURNAME AGE24/AGE ADDRESSBAKU/ADDRESS /Personal Education SCHOOLXetai 191/SCHOOL UNIVERSITYQafqaz University/UNIVERSITY /Education /info So, i wrote script in PERL. And it is below #* #!/usr/bin/perl open(FILE,info.xml) or xeta(File can not open...); @b = FILE; close(FILE); $search = ''; @results = grep(/$search/,@b); print @results\n; #* And have a other script and its below #* #!/usr/bin/perl -w use XML::Simple; my $infile = 'info.xml'; my $xml= XMLin(); print XMLout($xml), \n; #* So, i need to get that information from indo.xml (Ulfet, Tanriverdiyev, 24, Baku,) I want to get without tags information. I read that in PERL has a module which can read files(XML) and get from information whitout tags. Please help me, how can i get. I wrote script which can find and get ftom file that information without XML tags. Thank you very much in advance the documentation (available online here): http://search.cpan.org/~grantm/XML-Simple-2.14/lib/XML/Simple.pm#EXAMPLES has some examples that are very similar to what you are attempting. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
do I need further modules?
Hello, I want to use Tk::jpeg::lite. I have a standard SuSE 9.2 (perl 5.8.5) installation and I have added every package which even smells like Perl, also Perl Tk. When compiling Tk::jpeg::lite (perl Makefile.PL) I get the following output: (I have marked the interesting things) ... Checking if your kit is complete... Looks good Warning: prerequisite Tk 0 not found. !!^^!! (1) Finding dependancies for Lite.xs Finding dependancies for imgJPEG.c Writing Makefile for Tk::JPEG::Lite OK, now Make: (it follows the output): cp Lite.pm blib/lib/Tk/JPEG/Lite.pm /usr/bin/perl /usr/lib/perl5/5.8.6/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8.6/ExtUtils/typemap -typemap /usr/lib/perl5/vendor_perl/5.8.6/i586-linux-thread-multi/Tk/typemap Lite.xs Lite.xsc mv Lite.xsc Lite.c cc -c -I/usr/lib/perl5/vendor_perl/5.8.6/i586-linux-thread-multi/Tk -I/usr/local/include -I/usr/X11R6/include -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -g -Wall -pipe -DVERSION=\2.01403\ -DXS_VERSION=\800.024\ -fPIC -I/usr/lib/perl5/5.8.6/i586-linux-thread-multi/CORE -DHAVE_JPEGLIB_H -Wall -Wno-implicit-int -Wno-comment -Wno-unused -D__USE_FIXED_PROTOTYPES__ Lite.c cc -c -I/usr/lib/perl5/vendor_perl/5.8.6/i586-linux-thread-multi/Tk -I/usr/local/include -I/usr/X11R6/include -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -g -Wall -pipe -DVERSION=\2.01403\ -DXS_VERSION=\800.024\ -fPIC -I/usr/lib/perl5/5.8.6/i586-linux-thread-multi/CORE -DHAVE_JPEGLIB_H -Wall -Wno-implicit-int -Wno-comment -Wno-unused -D__USE_FIXED_PROTOTYPES__ In file included from /usr/lib/perl5/5.8.5/i586-linux-thread-multi/pTk/tkPort.h:24, from Lite.xs:13: /usr/lib/perl5/5.8.5/i586-linux-thread-multi/pTk/Lang.h:11:22: tkConfig.h: Datei oder Verzeichnis nicht gefunden --(file or directory not found) !!!! ()2) In file included from Lite.xs:13: /usr/lib/perl5/5.8.5/i586-linux-thread-multi/pTk/tkPort.h:44:35: tkUnixPort.h: Datei oder Verzeichnis nicht gefunden -- (file or directory not found) !!^!! (2) Lite.xs:16:24: pTk/imgInt.h: Datei oder Verzeichnis nicht gefunden !!^^!!(2) Now my questions: 1. What is prerequisite Tk 0? 2. Where do I get the missing files from directory pTk? Thanks for every answer, Richard -- Richard Müller - Am Spring 9 - D 58802 Balve-Eisborn www.oeko-sorpe.de - www.phytoplankton.info -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Alcatel CORBA 5620 OSS
On 10/17/05, Tielman Koekemoer (TNE) [EMAIL PROTECTED] wrote: We have an Alcatel CORBA 5620 gateway from which we have extract information. Does anyone know of a module that would enable Perl to access this service? I searched the CPAN's archive but could not find anything. Apologies if this is the wrong list to ask - which would be the best list? I don't know what an Alcatel CORBA 5620 gateway is, and alcatel.com doesn't help much either: http://www.alcatel.com/products/productsbyreference.jhtml?productRange=5-6pageNumber=3 Do you know what it is? Could you explain to us what it is, what it does, and how it's accessible? I'm going to assume that from which we have extract information means that you need to get some information off of the gateway thingy. Is that correct? More info is always good. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: do I need further modules?
On Mon, 2005-10-17 at 18:12 +0200, Richard Müller wrote: Hello, I want to use Tk::jpeg::lite. I have a standard SuSE 9.2 (perl 5.8.5) installation and I have added every package which even smells like Perl, also Perl Tk. When compiling Tk::jpeg::lite (perl Makefile.PL) I get the following output: (I have marked the interesting things) Hello. Can't you use YAST, if you are on SUSE, to do all this for you? Or is that what you have done? Dan. ... Checking if your kit is complete... Looks good Warning: prerequisite Tk 0 not found. !!^^!! (1) Finding dependancies for Lite.xs Finding dependancies for imgJPEG.c Writing Makefile for Tk::JPEG::Lite OK, now Make: (it follows the output): cp Lite.pm blib/lib/Tk/JPEG/Lite.pm /usr/bin/perl /usr/lib/perl5/5.8.6/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8.6/ExtUtils/typemap -typemap /usr/lib/perl5/vendor_perl/5.8.6/i586-linux-thread-multi/Tk/typemap Lite.xs Lite.xsc mv Lite.xsc Lite.c cc -c -I/usr/lib/perl5/vendor_perl/5.8.6/i586-linux-thread-multi/Tk -I/usr/local/include -I/usr/X11R6/include -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -g -Wall -pipe -DVERSION=\2.01403\ -DXS_VERSION=\800.024\ -fPIC -I/usr/lib/perl5/5.8.6/i586-linux-thread-multi/CORE -DHAVE_JPEGLIB_H -Wall -Wno-implicit-int -Wno-comment -Wno-unused -D__USE_FIXED_PROTOTYPES__ Lite.c cc -c -I/usr/lib/perl5/vendor_perl/5.8.6/i586-linux-thread-multi/Tk -I/usr/local/include -I/usr/X11R6/include -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -g -Wall -pipe -DVERSION=\2.01403\ -DXS_VERSION=\800.024\ -fPIC -I/usr/lib/perl5/5.8.6/i586-linux-thread-multi/CORE -DHAVE_JPEGLIB_H -Wall -Wno-implicit-int -Wno-comment -Wno-unused -D__USE_FIXED_PROTOTYPES__ In file included from /usr/lib/perl5/5.8.5/i586-linux-thread-multi/pTk/tkPort.h:24, from Lite.xs:13: /usr/lib/perl5/5.8.5/i586-linux-thread-multi/pTk/Lang.h:11:22: tkConfig.h: Datei oder Verzeichnis nicht gefunden --(file or directory not found) !!!! ()2) In file included from Lite.xs:13: /usr/lib/perl5/5.8.5/i586-linux-thread-multi/pTk/tkPort.h:44:35: tkUnixPort.h: Datei oder Verzeichnis nicht gefunden -- (file or directory not found) !!^!! (2) Lite.xs:16:24: pTk/imgInt.h: Datei oder Verzeichnis nicht gefunden !!^^!!(2) Now my questions: 1. What is prerequisite Tk 0? 2. Where do I get the missing files from directory pTk? Thanks for every answer, Richard -- Richard Müller - Am Spring 9 - D 58802 Balve-Eisborn www.oeko-sorpe.de - www.phytoplankton.info -- Daniel Klose PhD Student - Taylor Group Mathematical Biology National Institute for Medical Research The Ridgeway Mill Hill London NW7 1AA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Help unsubscribing from list
How do I unsubscribe from the list? Thank you __ William Ampeh (x3939) Federal Reserve Board -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: do I need further modules?
Am Montag, 17. Oktober 2005 18:16 schrieb Dan Klose: On Mon, 2005-10-17 at 18:12 +0200, Richard Müller wrote: Hello, I want to use Tk::jpeg::lite. I have a standard SuSE 9.2 (perl 5.8.5) installation and I have added every package which even smells like Perl, also Perl Tk. When compiling Tk::jpeg::lite (perl Makefile.PL) I get the following output: (I have marked the interesting things) Hello. Can't you use YAST, if you are on SUSE, to do all this for you? Or is that what you have done? Dan. That's what I did: With yast I installed everything which looked even a little like perl - but it's oviously not enough! Richard -- Richard Müller - Am Spring 9 - D 58802 Balve-Eisborn www.oeko-sorpe.de - www.phytoplankton.info -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Help unsubscribing from list
NO IDEA - sorry! To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Help unsubscribing from list
Am Montag, 17. Oktober 2005 18:20 schrieb [EMAIL PROTECTED]: How do I unsubscribe from the list? Thank you To unsubscribe, send a message to: [EMAIL PROTECTED] xx = email address before @, yy = email address after @ -- Richard Müller - Am Spring 9 - D 58802 Balve-Eisborn www.oeko-sorpe.de - www.phytoplankton.info -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: I need help here
Bowen, Bruce mailto:[EMAIL PROTECTED] wrote: : If I declare my 'lexical variables' at the beginning of a : file, and then refer to the variable without the 'my ' in front : of it, does that change it back to a package variable or does : that create a new package variable? Once a variable is declared using 'my' it can never be also be a package variable. They can refer to each other in such a way that changing one seems to change the other, but they are not the same type of variable. Think of the two types of perl variables as an apple orchard and peach orchard. If we grow an apple tree it can never become a peach tree and there are no peachapple trees. :) In no case can you use 'my' on the same variable in the same scope. Well, you can, but the warnings module will throw a warning about masking an earlier declaration. If your not sure what scope is, read the article I mentioned earlier. http://perl.plover.com/FAQs/Namespaces.html Now, you should try to keep your variables in the smallest scope possible. That means do not declare all of them at the top of your script. In some programming languages this is encouraged. Not in perl. Trust me and don't do it like that. Having said that, there are sometimes reasons to place a variable at the top of a script. Configuration variables come to mind. While developing it is nice to have a configuration hash at the top of the script. In production, we would probably add a configuration or serialization module and place that information in another file. HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Running Perl on PC
Hello I learned Perl on a Unix System and I would like to use perl on a PC. Do I need to install active perl? What are the steps to running perl on a PC? Thanks, Andrew -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Running Perl on PC
Hi Well first of all if your PC has WinXp you need to download active perl But the most important is that there are some difference between both perl's I would recommend you google a bit to see some tutorial just to get the correct sintaxis Or to buy a book perl by example has both Win and Unix For active perl install Active perl does most of the instalation don't worry Armando Gomez Guajardo Process Engineer Work Ph 956 547 6438 Beeper956 768 4070 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, October 17, 2005 2:21 PM To: beginners@perl.org Subject: Running Perl on PC Hello I learned Perl on a Unix System and I would like to use perl on a PC. Do I need to install active perl? What are the steps to running perl on a PC? Thanks, Andrew -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Running Perl on PC
ActivePerl from ActiveState is the best way to go in my opinion. You can install it with a quick MSI and it will automatically associate the Perl (.pl, .plx, etc) extensions with Perl. It also comes with a nice package manager, PPM, that lets you quickly find precompiled modules for Windows. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, October 17, 2005 12:21 PM To: beginners@perl.org Subject: Running Perl on PC Hello I learned Perl on a Unix System and I would like to use perl on a PC. Do I need to install active perl? What are the steps to running perl on a PC? Thanks, Andrew -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Running Perl on PC
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, October 17, 2005 2:21 PM To: beginners@perl.org Subject: Running Perl on PC Hello I learned Perl on a Unix System and I would like to use perl on a PC. Do I need to install active perl? What are the steps to running perl on a PC? Thanks, Andrew -- Well this is how I do it... Install ActivePerl http://www.activestate.com/Products/ActivePerl/ I use PerlEdit for the editor... Which work just fine, however after the 30 day trial you will lose the ability to debug and run your scripts from the editor. I would recommend running/debugging them from the command prompt anyway, so no big deal. http://www.indigostar.com/perledit.html Let me know if you have any questions. BTW: your probably familiar w/ cpan to install your modules. To do this w/ ActivePerl, just open a command prompt and type ppm. Perl Package Manager. Hope this Helps. Brian -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Running Perl on PC
-Original Message- From: Brian Volk [mailto:[EMAIL PROTECTED] Sent: Monday, October 17, 2005 3:51 PM To: [EMAIL PROTECTED]; beginners@perl.org Subject: RE: Running Perl on PC -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, October 17, 2005 2:21 PM To: beginners@perl.org Subject: Running Perl on PC Hello I learned Perl on a Unix System and I would like to use perl on a PC. Do I need to install active perl? What are the steps to running perl on a PC? Thanks, Andrew -- Well this is how I do it... Install ActivePerl http://www.activestate.com/Products/ActivePerl/ I use PerlEdit for the editor... If you're used to 'vi' on *NIX, download gvim for Windows (v. 6.4 just came out). It provides pretty much all the features available in vim for UNIX. NOTE: I'm not trying to start an editor-of-choice war on the list, just trying to help in transitioning from *NIX to Windows. ry Which work just fine, however after the 30 day trial you will lose the ability to debug and run your scripts from the editor. I would recommend running/debugging them from the command prompt anyway, so no big deal. http://www.indigostar.com/perledit.html Let me know if you have any questions. BTW: your probably familiar w/ cpan to install your modules. To do this w/ ActivePerl, just open a command prompt and type ppm. Perl Package Manager. Hope this Helps. Brian -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
XML::Simple + Math::Currency / Math::BigInt problem
Hello list. After I converted some parts of my program to use Math::Currency I faced the inconvenience of my XML generators not working anymore. 20 minutes of jumping up and down with the debugger yielded that the following dumbed down example: use Math::Currency; use XML::Simple; my $number = Math::Currency-new ('1'); my $string = XMLout ( { number = $number } ); dies with this: Can't call method as_number on unblessed reference at /usr/share/perl/5.8/Math/BigFloat.pm line 129. If I change Math::Currency to Math::BigInt - the result is slightly different but the thing still dies. Any help would be greatly appreciated Peter -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Destroying an object
Greetings. I've got an OO object that I want to destroy from inside the object itself. I'm trying: sub destroy_self { my $self = shift; $self = undef; } But this doesn't work. What is the correct way of doing it? -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Which is better?
Thanks to Thomas, John, Charles and Peter. Lots of great input concerning the *why* question. I will certainly adapt my style (or lack thereof) to the better method. As far as the part about the CGI stuff. While that is not in my realm at this time, who knows when it might be. Best to adopt the proper method now and not have to be concerned about it later. Thanks again to all for the great, thorough explanations. Mike Charles K. Clarkson wrote: M. Lewis mailto:[EMAIL PROTECTED] wrote: : open my $fh, '', $input_file or die qq(Cannot open $input_file: $!); [snip] : Charles opted to use qq() which cause him to have to enclose the : $input_file in . $input_file is in quotes just in case I tried to open a file that has leading or trailing spaces in the name. I once wrote a script which opened a number of files and I couldn't figure out why one file was not opening. (It was early morning, as I recall.) After adding the quotes I found stray white space in the name. (I think I was splitting white space with split /\s/; instead of split ' '; and the leading space on the first argument was left on.) Here's a very simple example. In my directory in.txt exists, but not in.txt. (Note: I used warn here to get all the error messages. Normally we die on fatal errors.) #!/usr/bin/perl use strict; use warnings; #use diagnostics; my $file = ' in.txt'; open my $fh, '', $file or warn qq(Cannot open $file: $!); close $fh or warn qq(Cannot close $file: $!); warn \n; open $fh, '', $file or warn qq(Cannot open $file: $!); close $fh or warn qq(Cannot close $file: $!); __END__ Cannot open in.txt: No such file or directory at bb.pl line 9. Cannot close in.txt: Bad file descriptor at bb.pl line 11. Cannot open in.txt: No such file or directory at bb.pl line 13. Cannot close in.txt: Bad file descriptor at bb.pl line 15. At the end of a long programming night, in the early morning hours, as the text on the screen seems to be moving, the first set of errors made debugging easier. You may be surprised how many times I have tested example code for an answer on this list and found this. :) Cannot open : No such file or directory at . . . The quotes around the file name are not needed for interpolation. (The qq() operator does that.) They just aid me in picking up extra white space and have saved me some debugging time in the past. I wrap the hole message in qq() because escaped quotes '\' look so ugly (to me). HTH, Charles K. Clarkson -- The whole is the sum of its parts, plus one or more bugs 23:15:01 up 1 day, 7:38, 4 users, load average: 0.04, 0.06, 0.08 Linux Registered User #241685 http://counter.li.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response