Testing my CGI
I’m using WWW::Mechanize for testing my CGI. I’m having trouble with the $mech-tick Here’s my code : ok($mech-form_name('cdr_format'),getting form cdr_format); print pAllFields = . $mech-value('pAllFields') . \n; 219- ok($mech-tick('pAllFields',1), 'Setting checkbox to native CDR format'); 220- ok($mech-tick('pAllFields’,0), 'Setting checkbox to native CDR format’); Here’s a snippet of the html : div id='myForm' form name='cdr_format' method='POST' action='file_admin.cgi' input type='hidden' name='rm' value='process_cdr_format' input type='hidden' name='CGISESSID' value='ec4c3463d5a7f9d04d2924968413f240' input type='hidden' name='cdr_format' value='1' table border='0' cellpadding='3' cellspacing='0' width='100%' tr td class='fieldLabel' width='60%' We would like the files in native CDR format: /td td class='field' input type='checkbox' class='checkbox' name='pAllFields' value='1' /td /tr When I execute I get this : ok 40 - getting form cdr_format Use of uninitialized value in concatenation (.) or string at ./test_cportal.pl line 218. pAllFields = not ok 41 - Setting checkbox to native CDR format # Failed test 'Setting checkbox to native CDR format' # at ./test_cportal.pl line 219. not ok 42 - Setting checkbox to native CDR format # Failed test 'Setting checkbox to native CDR format' # at ./test_cportal.pl line 220. Here’s the documentation from WWW::Mechanize $mech-tick( $name, $value [, $set] ) Ticks the first checkbox that has both the name and value associated with it on the current form. Dies if there is no named check box for that value. Passing in a false value as the third optional argument will cause the checkbox to be unticked.
Re: Testing my CGI
Look at the source code for the module. The 'tick' method just uses a bare 'return' on success, which means it's going to fail an ok() test regardless of whether or not it works. You may also want to look at Test::WWW::Mechanize. chrs, john. On Tue, Nov 4, 2014 at 7:30 AM, Patton, Billy N billy.pat...@h3net.com wrote: I’m using WWW::Mechanize for testing my CGI. I’m having trouble with the $mech-tick Here’s my code : ok($mech-form_name('cdr_format'),getting form cdr_format); print pAllFields = . $mech-value('pAllFields') . \n; 219- ok($mech-tick('pAllFields',1), 'Setting checkbox to native CDR format'); 220- ok($mech-tick('pAllFields’,0), 'Setting checkbox to native CDR format’); Here’s a snippet of the html : div id='myForm' form name='cdr_format' method='POST' action='file_admin.cgi' input type='hidden' name='rm' value='process_cdr_format' input type='hidden' name='CGISESSID' value='ec4c3463d5a7f9d04d2924968413f240' input type='hidden' name='cdr_format' value='1' table border='0' cellpadding='3' cellspacing='0' width='100%' tr td class='fieldLabel' width='60%' We would like the files in native CDR format: /td td class='field' input type='checkbox' class='checkbox' name='pAllFields' value='1' /td /tr When I execute I get this : ok 40 - getting form cdr_format Use of uninitialized value in concatenation (.) or string at ./test_cportal.pl line 218. pAllFields = not ok 41 - Setting checkbox to native CDR format # Failed test 'Setting checkbox to native CDR format' # at ./test_cportal.pl line 219. not ok 42 - Setting checkbox to native CDR format # Failed test 'Setting checkbox to native CDR format' # at ./test_cportal.pl line 220. Here’s the documentation from WWW::Mechanize $mech-tick( $name, $value [, $set] ) Ticks the first checkbox that has both the name and value associated with it on the current form. Dies if there is no named check box for that value. Passing in a false value as the third optional argument will cause the checkbox to be unticked. -- To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org For additional commands, e-mail: beginners-cgi-h...@perl.org http://learn.perl.org/
Testing a standalone script
Hi there, I have some relatively small standalone perl scripts where I would like to include tests. Which is the recommended way to test standalone scripts? -- Manfred -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing a standalone script
On Tue, 29 Oct 2013 17:10:51 +0100 Manfred Lotz manfred.l...@arcor.de wrote: Hi there, I have some relatively small standalone perl scripts where I would like to include tests. Which is the recommended way to test standalone scripts? Put the tests in a directory call t under the source. And see `man prove`. `prove` is a Perl tool for testing modules but it can be adapted for scripts. Each test script is given the extension *.t . -- Don't stop where the ink does. Shawn -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing a standalone script
On Tue, 29 Oct 2013 12:36:58 -0400 Shawn H Corey shawnhco...@gmail.com wrote: On Tue, 29 Oct 2013 17:10:51 +0100 Manfred Lotz manfred.l...@arcor.de wrote: Hi there, I have some relatively small standalone perl scripts where I would like to include tests. Which is the recommended way to test standalone scripts? Put the tests in a directory call t under the source. And see `man prove`. `prove` is a Perl tool for testing modules but it can be adapted for scripts. Each test script is given the extension *.t . This is exactly what I don't want to do. IMHO, for testing modules or applications this is the way to go. However, for a standalone script I'd like to have my test data inside the script itself. -- Manfred -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing a standalone script
On Tue, Oct 29, 2013 at 11:02 AM, Manfred Lotz manfred.l...@arcor.de wrote: This is exactly what I don't want to do. IMHO, for testing modules or applications this is the way to go. However, for a standalone script I'd like to have my test data inside the script itself. Well, you could add some input values and expected results in a __DATA__ section (maybe as some sort of YAML or other serialization format), and then add a '-T' runtime option that reads that data in, runs it through the program, and uses 'require' to load Test::More to get access to functions like is() and ok() and friends, and use those to compare your inputs to your expected results. Is something like that what you're envisioning? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing a standalone script
On Tue, 29 Oct 2013 12:01:52 -0700 John SJ Anderson geneh...@genehack.org wrote: On Tue, Oct 29, 2013 at 11:02 AM, Manfred Lotz manfred.l...@arcor.de wrote: This is exactly what I don't want to do. IMHO, for testing modules or applications this is the way to go. However, for a standalone script I'd like to have my test data inside the script itself. Well, you could add some input values and expected results in a __DATA__ section (maybe as some sort of YAML or other serialization format), and then add a '-T' runtime option that reads that data in, runs it through the program, and uses 'require' to load Test::More to get access to functions like is() and ok() and friends, and use those to compare your inputs to your expected results. Is something like that what you're envisioning? This comes close. In the meantime I found that there are even packages like Test::Standalone or Test::Inline supporting what I want. Does anybody know those packages and is able to recommend one? -- Manfred -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: I'd like to explain to me how to do testing on lists and list slices
Hi ml, I find you hard to understand, but I'll try. On Sat, 10 Mar 2012 03:06:27 +0100 ml m...@smtp.fakessh.eu wrote: hello the list hello the perl guru hello this I want to know how to work on slices of lists. I has 3 slices of the form. $t[0] = user; $t[1] = ip; $t[2] = time(); First of all, $t[0], $t[1] and $t[2] are not slices of a list, but *elements* of the *array* variable @t. Slices are something like @arr[4 .. 10] or @arr[@indexes]. Otherwise, you should generally avoid using arrays for such data of heterogeneous types and kinds, and instead use objects or at least hashes. See: * http://perl-begin.org/topics/object-oriented/ * http://perl-begin.org/topics/hashes/ the registration of the list are checked by me Do you mean that you check that the list is properly populated. I know what the file contains and recording are separated by a space (/\s+/) Should it be records instead of recording? I would like to test on how many times a user or an ip c is connected via the time value and authorize or not the execution of the following function I'd like to explain to me how to do testing on lists and list slices You can use any of the Perl operators and functions that operate on lists and arrays like foreach, http://perldoc.perl.org/functions/grep.html , http://perldoc.perl.org/functions/map.html or http://search.cpan.org/perldoc?List::Util , http://search.cpan.org/dist/List-MoreUtils/ , http://search.cpan.org/dist/List-UtilsBy/ , etc. There's more information about it in the books and tutorials on http://perl-begin.org/ and on http://perl-tutorial.org/ . Regards, Shlomi Fish -- - Shlomi Fish http://www.shlomifish.org/ Rethinking CPAN - http://shlom.in/rethinking-cpan Chuck Norris is the ghost author of the entire Debian GNU/Linux distribution. And he wrote it in 24 hours, while taking snack breaks. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: I'd like to explain to me how to do testing on lists and list slices
Le samedi 10 mars 2012 à 10:51 +0200, Shlomi Fish a écrit : Hi ml, I find you hard to understand, but I'll try. On Sat, 10 Mar 2012 03:06:27 +0100 ml m...@smtp.fakessh.eu wrote: hello the list hello the perl guru hello this I want to know how to work on slices of lists. I has 3 slices of the form. $t[0] = user; $t[1] = ip; $t[2] = time(); First of all, $t[0], $t[1] and $t[2] are not slices of a list, but *elements* of the *array* variable @t. Slices are something like @arr[4 .. 10] or @arr[@indexes]. Otherwise, you should generally avoid using arrays for such data of heterogeneous types and kinds, and instead use objects or at least hashes. See: * http://perl-begin.org/topics/object-oriented/ * http://perl-begin.org/topics/hashes/ the registration of the list are checked by me Do you mean that you check that the list is properly populated. I know what the file contains and recording are separated by a space (/\s+/) Should it be records instead of recording? I would like to test on how many times a user or an ip c is connected via the time value and authorize or not the execution of the following function I'd like to explain to me how to do testing on lists and list slices You can use any of the Perl operators and functions that operate on lists and arrays like foreach, http://perldoc.perl.org/functions/grep.html , http://perldoc.perl.org/functions/map.html or http://search.cpan.org/perldoc?List::Util , http://search.cpan.org/dist/List-MoreUtils/ , http://search.cpan.org/dist/List-UtilsBy/ , etc. There's more information about it in the books and tutorials on http://perl-begin.org/ and on http://perl-tutorial.org/ . Regards, Shlomi Fish -- - Shlomi Fish http://www.shlomifish.org/ Rethinking CPAN - http://shlom.in/rethinking-cpan Chuck Norris is the ghost author of the entire Debian GNU/Linux distribution. And he wrote it in 24 hours, while taking snack breaks. Please reply to list if it's a mailing list post - http://shlom.in/reply . thank you for this masterful explanation. I have already a very clear idea of what I want to do this precise explanation is useful to me -- http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0xC2626742 gpg --keyserver pgp.mit.edu --recv-key C2626742 http://urlshort.eu fakessh @ http://gplus.to/sshfake http://gplus.to/sshswilting http://gplus.to/john.swilting https://lists.fakessh.eu/mailman/ This list is moderated by me, but all applications will be accepted provided they receive a note of presentation signature.asc Description: Ceci est une partie de message numériquement signée
I'd like to explain to me how to do testing on lists and list slices
hello the list hello the perl guru hello this I want to know how to work on slices of lists. I has 3 slices of the form. $t[0] = user; $t[1] = ip; $t[2] = time(); the registration of the list are checked by me I know what the file contains and recording are separated by a space (/\s+/) I would like to test on how many times a user or an ip c is connected via the time value and authorize or not the execution of the following function I'd like to explain to me how to do testing on lists and list slices sincerely -- http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0xC2626742 gpg --keyserver pgp.mit.edu --recv-key C2626742 http://urlshort.eu fakessh @ http://gplus.to/sshfake http://gplus.to/sshswilting http://gplus.to/john.swilting https://lists.fakessh.eu/mailman/ This list is moderated by me, but all applications will be accepted provided they receive a note of presentation signature.asc Description: Ceci est une partie de message numériquement signée
Testing for Missing Packages
Hello everyone. Here is my question: What is the preferred way to test a system for installed modules? For example, I have a Perl program I would like to distribute. It depends on a number of modules from CPAN and I would like an easy way to test for the existence of those modules. I suppose the user could always run the program and then install them whenever he gets an error about the packages not being found, but it feels like there should be a friendlier way to address that. Is there a common way in Perl to say, “This program depends on these packages and requires them to be installed before running?” And if so, is there a common, automated way to prompt the user to install any of those missing packages? Thanks in advanced and happy holidays everyone! -- ejmr 南無妙法蓮華經 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing for Missing Packages
Hi Eric, On Sat, 24 Dec 2011 20:23:17 -0500 Eric James Michael Ritz lobbyjo...@gmail.com wrote: Hello everyone. Here is my question: What is the preferred way to test a system for installed modules? For example, I have a Perl program I would like to distribute. It depends on a number of modules from CPAN and I would like an easy way to test for the existence of those modules. I suppose the user could always run the program and then install them whenever he gets an error about the packages not being found, but it feels like there should be a friendlier way to address that. Is there a common way in Perl to say, “This program depends on these packages and requires them to be installed before running?” And if so, is there a common, automated way to prompt the user to install any of those missing packages? Yes, there is. See: * http://search.cpan.org/dist/Module-Build/ * http://search.cpan.org/dist/Module-Install/ * http://search.cpan.org/dist/ExtUtils-MakeMaker/ Regards, Shlomi Fish Thanks in advanced and happy holidays everyone! -- ejmr 南無妙法蓮華經 -- - Shlomi Fish http://www.shlomifish.org/ Freecell Solver - http://fc-solve.shlomifish.org/ You can never truly appreciate The Gilmore Girls until you’ve watched it in the original Klingon. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: AW: Testing File Contents
On 2011-03-02 19:22, Christian Marquardt wrote: open CFG, '', $_file || die(could not open file: $_file!); That only dies if $_file is false. Funny that you did use parentheses with die. Some '$' characters were missing too: open my $CFG, '', $_file or die Error opening '$_file', $!; -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing File Contents
On Mar 2, 9:55 am, lm7...@gmail.com (Matt) wrote: I am looking for a simple way to test if a file does not contain a string. This is on a linux box. if myfile does not contain mystring { #do_something; } The file is basically a list of names and I want to test that a certain name is not in there. Is there an easy way to do that? Yet another way: perl -0777 -nlE ' say /mystring/ ? yes : no ' file See: perldoc perlrun for explanation of -0777 -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Testing File Contents
I am looking for a simple way to test if a file does not contain a string. This is on a linux box. if myfile does not contain mystring { #do_something; } The file is basically a list of names and I want to test that a certain name is not in there. Is there an easy way to do that? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing File Contents
# Untested use strict; use warnings; open my $fh, '', my_file; while($fh){ if ($_ !~ /my_string/) { # Do something } } The other way would be on shell - # Untested grep my_string my_file if [ $? -eq 1 ] then echo Do something fi ~Parag On Wed, Mar 2, 2011 at 9:55 AM, Matt lm7...@gmail.com wrote: I am looking for a simple way to test if a file does not contain a string. This is on a linux box. if myfile does not contain mystring { #do_something; } The file is basically a list of names and I want to test that a certain name is not in there. Is there an easy way to do that? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing File Contents
On Wed, Mar 2, 2011 at 10:11 AM, Parag Kalra paragka...@gmail.com wrote: Sorry for the top post. I should have done bottom post. :( # Untested use strict; use warnings; open my $fh, '', my_file; while($fh){ if ($_ !~ /my_string/) { # Do something } } The other way would be on shell - # Untested grep my_string my_file if [ $? -eq 1 ] then echo Do something fi ~Parag On Wed, Mar 2, 2011 at 9:55 AM, Matt lm7...@gmail.com wrote: I am looking for a simple way to test if a file does not contain a string. This is on a linux box. if myfile does not contain mystring { #do_something; } The file is basically a list of names and I want to test that a certain name is not in there. Is there an easy way to do that? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
AW: Testing File Contents
The easiest way in my opinion is to use the 'grep' function like this: my $searchstring=whatever; open CFG, '', $_file || die(could not open file: $_file!); my @data=CFG; close CFG; if ( grep /$searchstring/i, @data ) { print $searchstring found\n; } If you negate the grep like this: @data = grep !/$searchstring/i, @data; ... you can remove the searchstring from your array (file-text). best regards Christian Von: Matt [lm7...@gmail.com] Gesendet: Mittwoch, 2. März 2011 18:55 Bis: beginners@perl.org Betreff: Testing File Contents I am looking for a simple way to test if a file does not contain a string. This is on a linux box. if myfile does not contain mystring { #do_something; } The file is basically a list of names and I want to test that a certain name is not in there. Is there an easy way to do that? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing File Contents
# Untested use strict; use warnings; open my $fh, '', my_file; while($fh){ if ($_ !~ /my_string/) { # Do something } } This triggers on EVERY line of the file that does not contain the string. I just want to trigger once if its no where in the file. The other way would be on shell - # Untested grep my_string my_file if [ $? -eq 1 ] then echo Do something fi ~Parag On Wed, Mar 2, 2011 at 9:55 AM, Matt lm7...@gmail.com wrote: I am looking for a simple way to test if a file does not contain a string. This is on a linux box. if myfile does not contain mystring { #do_something; } The file is basically a list of names and I want to test that a certain name is not in there. Is there an easy way to do that? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing File Contents
The easiest way in my opinion is to use the 'grep' function like this: my $searchstring=whatever; open CFG, '', $_file || die(could not open file: $_file!); my @data=CFG; close CFG; if ( grep /$searchstring/i, @data ) { print $searchstring found\n; } This sorta worked. Needed a minor change. unless ( grep /$searchstring/i, @data ) { print $searchstring not found\n; Thanks. If you negate the grep like this: @data = grep !/$searchstring/i, @data; ... you can remove the searchstring from your array (file-text). I am looking for a simple way to test if a file does not contain a string. This is on a linux box. if myfile does not contain mystring { #do_something; } The file is basically a list of names and I want to test that a certain name is not in there. Is there an easy way to do that? -- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing File Contents
On Wed, 2 Mar 2011, Matt wrote: The easiest way in my opinion is to use the 'grep' function like this: my $searchstring=whatever; open CFG, '', $_file || die(could not open file: $_file!); my @data=CFG; close CFG; if ( grep /$searchstring/i, @data ) { print $searchstring found\n; } This sorta worked. Needed a minor change. unless ( grep /$searchstring/i, @data ) { print $searchstring not found\n; Thanks. My apologies if I'm beating a dead horse here, but I'm new to Perl and thought of a slightly different approach: my $searchrx = qr/whatever/; # or q/whatever/ if you don't need regexp @ARGV or die qq/you didn't specify a filename\n/; open FH, q//, shift @ARGV or die qq/file open error: $!/; $_ = join q//, FH; close FH; if ( ! m/$searchrx/s ) { print qq/pattern not found\n/; # do something } I'm not sure which is more Perlish, but I hear TMTOWTDI is supposed to be valued, too. I welcome any criticism. Brian -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
RE: Testing File Contents
From: Brian F. Yulga [mailto:byu...@langly.dyndns.org] On Wed, 2 Mar 2011, Matt wrote: The easiest way in my opinion is to use the 'grep' function like this: my $searchstring=whatever; open CFG, '', $_file || die(could not open file: $_file!); my @data=CFG; close CFG; if ( grep /$searchstring/i, @data ) { print $searchstring found\n; } This sorta worked. Needed a minor change. unless ( grep /$searchstring/i, @data ) { print $searchstring not found\n; Thanks. My apologies if I'm beating a dead horse here, but I'm new to Perl and thought of a slightly different approach: my $searchrx = qr/whatever/; # or q/whatever/ if you don't need regexp This is probably personal preference, but I prefer to provide a more meaningful name rather than using @ARGV. Plus you have lost the filename once you 'shifted' @ARGV in the open statement. May want to use the file name in the open error statement or later. Also, I would not use the '/' as your quote delimiter - that's too recognizable as being used as the pattern match delimiter. Use actual double quotes () unless there are double quotes in the string - also less typing. Instead of '/' may want to use '{' and '}' if using qq (see perldoc perlop, Quote and Quote-like Operators). my $fileName = shift @ARGV or die You did not specify a filename\n; @ARGV or die qq/you didn't specify a filename\n/; Use lexical variable for filehandle. Makes things easier - such as passing to a function. open my $FH,'', $fileName or die Error opening $fileName: $!\n; open FH, q//, shift @ARGV or die qq/file open error: $!/; The join is unnecessary, set the input_record_separator ($/) to undef or use a local copy of $/ (see perldoc perlvar). If this is undefined, the entire file will be read into a variable. $_ = join q//, FH; close FH; if ( ! m/$searchrx/s ) { print qq/pattern not found\n/; # do something } I'm not sure which is more Perlish, but I hear TMTOWTDI is supposed to be valued, too. I welcome any criticism. Brian HTH, Ken -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing File Contents
BFY == Brian F Yulga byu...@langly.dyndns.org writes: BFY My apologies if I'm beating a dead horse here, but I'm new to Perl and BFY thought of a slightly different approach: BFY my $searchrx = qr/whatever/; # or q/whatever/ if you don't need regexp BFY @ARGV or die qq/you didn't specify a filename\n/; BFY open FH, q//, shift @ARGV or die qq/file open error: $!/; BFY $_ = join q//, FH; that is very slow and clunky. perl could slurp the file for you if you set $/ to undef. or better yet, use File::Slurp to do it BFY close FH; BFY if ( ! m/$searchrx/s ) { why are you using m//? the m isn't needed if you use // for delimiters the OP wants to know if a file has something or not, not to print each line. uri -- Uri Guttman -- u...@stemsystems.com http://www.sysarch.com -- - Perl Code Review , Architecture, Development, Training, Support -- - Gourmet Hot Cocoa Mix http://bestfriendscocoa.com - -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing File Contents
M == Matt lm7...@gmail.com writes: M I am looking for a simple way to test if a file does not contain a M string. This is on a linux box. M if myfile does not contain mystring { M #do_something; M } M The file is basically a list of names and I want to test that a M certain name is not in there. Is there an easy way to do that? 2 lines will do it: use File::Slurp ; unless( read_file( $file ) =~ /$whatever/ ) { # do something } faster and cleaner than the line by line methods others have posted. and if you want even more speed, and the file is long, then shell out to the grep utility and it has an option to only show you if a line is/isn't in file. i normally don't recommend shelling out but that would likely be the fastest solution for a large file. uri -- Uri Guttman -- u...@stemsystems.com http://www.sysarch.com -- - Perl Code Review , Architecture, Development, Training, Support -- - Gourmet Hot Cocoa Mix http://bestfriendscocoa.com - -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing File Contents
On Wed, Mar 2, 2011 at 3:37 PM, Uri Guttman u...@stemsystems.com wrote: M == Matt lm7...@gmail.com writes: 2 lines will do it: use File::Slurp ; unless( read_file( $file ) =~ /$whatever/ ) { # do something } what's better about File::Slurp than just doing: my( $file, $string ) = @argv; open my $fh, '', $file; while( $fh ) { print found if /$string/ ; } ???
Re: Testing File Contents
sw == shawn wilson ag4ve...@gmail.com writes: sw On Wed, Mar 2, 2011 at 3:37 PM, Uri Guttman u...@stemsystems.com wrote: M == Matt lm7...@gmail.com writes: 2 lines will do it: use File::Slurp ; unless( read_file( $file ) =~ /$whatever/ ) { # do something } what's better about File::Slurp than just doing: sw my( $file, $string ) = @argv; sw open my $fh, '', $file; sw while( $fh ) { sw print found if /$string/ ; sw } less code, much much faster. you loop over each line. my code does one regex call and stays inside perl for that. inside perl is usually faster than running perl op. use the benchmark module and look at the difference. it will be noticeable. also your code looks at every line whereas my will match the first time and then quit. that is another optimization. you could do the same if you exited the loop upon a match. uri -- Uri Guttman -- u...@stemsystems.com http://www.sysarch.com -- - Perl Code Review , Architecture, Development, Training, Support -- - Gourmet Hot Cocoa Mix http://bestfriendscocoa.com - -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing File Contents
On Mar 2, 2011 4:47 PM, Uri Guttman u...@stemsystems.com wrote: sw == shawn wilson ag4ve...@gmail.com writes: sw On Wed, Mar 2, 2011 at 3:37 PM, Uri Guttman u...@stemsystems.com wrote: M == Matt lm7...@gmail.com writes: 2 lines will do it: use File::Slurp ; unless( read_file( $file ) =~ /$whatever/ ) { # do something } what's better about File::Slurp than just doing: sw my( $file, $string ) = @argv; sw open my $fh, '', $file; sw while( $fh ) { sw print found if /$string/ ; sw } less code, much much faster. you loop over each line. my code does one regex call and stays inside perl for that. inside perl is usually faster than running perl op. use the benchmark module and look at the difference. it will be noticeable. How can I tell or do I figure out if code 'stays inside perl' or not? And, I'm not exactly sure what you mean by that either?
RE: Testing File Contents
-Original Message- From: Matt [mailto:lm7...@gmail.com] Sent: Wednesday, March 02, 2011 11:25 To: beginners@perl.org Subject: Re: Testing File Contents # Untested use strict; use warnings; open my $fh, '', my_file; while($fh){ if ($_ !~ /my_string/) { # Do something } } This triggers on EVERY line of the file that does not contain the string. I just want to trigger once if its no where in the file. Add a simple switch which is set to zero. Then look for the value you want. When found then you should be able to set to nonzero and leave the while. Then you should be able to check: if switch is not true, then send the email... If you have any questions and/or problems, please let me know. Thanks. Wags ;) David R. Wagner Senior Programmer Analyst FedEx Services 1.719.484.2097 Tel 1.719.484.2419 Fax 1.408.623.5963 Cell http://Fedex.com/us The other way would be on shell - # Untested grep my_string my_file if [ $? -eq 1 ] then echo Do something fi ~Parag On Wed, Mar 2, 2011 at 9:55 AM, Matt lm7...@gmail.com wrote: I am looking for a simple way to test if a file does not contain a string. This is on a linux box. if myfile does not contain mystring { #do_something; } The file is basically a list of names and I want to test that a certain name is not in there. Is there an easy way to do that? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing File Contents
sw == shawn wilson ag4ve...@gmail.com writes: less code, much much faster. you loop over each line. my code does one regex call and stays inside perl for that. inside perl is usually faster than running perl op. use the benchmark module and look at the difference. it will be noticeable. sw How can I tell or do I figure out if code 'stays inside perl' or not? And, sw I'm not exactly sure what you mean by that either? a regex will go inside perl's internals and run there. a perl loop as you wrote will execute perl operations. the perl interpreter is slow when executing operations (all perl ops, loop, syntax, etc). but once you get inside an operation it runs fast because the code is in c. uri -- Uri Guttman -- u...@stemsystems.com http://www.sysarch.com -- - Perl Code Review , Architecture, Development, Training, Support -- - Gourmet Hot Cocoa Mix http://bestfriendscocoa.com - -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing File Contents
On 02/03/2011 17:55, Matt wrote: I am looking for a simple way to test if a file does not contain a string. This is on a linux box. if myfile does not contain mystring { #do_something; } The file is basically a list of names and I want to test that a certain name is not in there. Is there an easy way to do that? Hey Matt If your file is small then this subroutine will do what you need. sub file_contains { my $file, $string = @_; open $file, '', $file or die $!; my %names = map { chomp; ($_ = 1) } DATA; return $names{$string}; } HTH, Rob -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing File Contents
RD == Rob Dixon rob.di...@gmx.com writes: RD On 02/03/2011 17:55, Matt wrote: I am looking for a simple way to test if a file does not contain a string. This is on a linux box. if myfile does not contain mystring { #do_something; } The file is basically a list of names and I want to test that a certain name is not in there. Is there an easy way to do that? RD Hey Matt RD If your file is small then this subroutine will do what you need. RD sub file_contains { RD my $file, $string = @_; you forgot the () around the my vars. that will assign the count of @_ to $file. not what you want. perl -le '@foo = qw( a b ) ;my $x, $y = @foo ; print $x $y' 2 RD open $file, '', $file or die $!; RD my %names = map { chomp; ($_ = 1) } DATA; don't you mean $file there? RD return $names{$string}; RD } uri -- Uri Guttman -- u...@stemsystems.com http://www.sysarch.com -- - Perl Code Review , Architecture, Development, Training, Support -- - Gourmet Hot Cocoa Mix http://bestfriendscocoa.com - -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing File Contents
On 02/03/2011 23:56, Uri Guttman wrote: RD == Rob Dixonrob.di...@gmx.com writes: RD On 02/03/2011 17:55, Matt wrote: I am looking for a simple way to test if a file does not contain a string. This is on a linux box. if myfile does not contain mystring { #do_something; } The file is basically a list of names and I want to test that a certain name is not in there. Is there an easy way to do that? RD Hey Matt RD If your file is small then this subroutine will do what you need. RDsub file_contains { RD my $file, $string = @_; you forgot the () around the my vars. that will assign the count of @_ to $file. not what you want. perl -le '@foo = qw( a b ) ;my $x, $y = @foo ; print $x $y' 2 RD open $file, '', $file or die $!; RD my %names = map { chomp; ($_ = 1) }DATA; don't you mean$file there? RD return $names{$string}; RD} Thanks Uri. It's midnight and I should be in bed :-/ Version 2: sub file_contains { my ($file, $string) = @_; open my $fh, '', $file or die $!; my %names = map { chomp; ($_ = 1) } $fh; return $names{$string}; } Rob -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing File Contents
RD == Rob Dixon rob.di...@gmx.com writes: RD Thanks Uri. It's midnight and I should be in bed :-/ we should all be in bed! RD Version 2: RD sub file_contains { RD my ($file, $string) = @_; RD open my $fh, '', $file or die $!; RD my %names = map { chomp; ($_ = 1) } $fh; RD return $names{$string}; RD } did you see my fast slurp version in this thread? uri -- Uri Guttman -- u...@stemsystems.com http://www.sysarch.com -- - Perl Code Review , Architecture, Development, Training, Support -- - Gourmet Hot Cocoa Mix http://bestfriendscocoa.com - -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing File Contents
Ken Slater wrote: From: Brian F. Yulga [mailto:byu...@langly.dyndns.org] On Wed, 2 Mar 2011, Matt wrote: The easiest way in my opinion is to use the 'grep' function like this: my $searchstring=whatever; open CFG, '', $_file || die(could not open file: $_file!); my @data=CFG; close CFG; if ( grep /$searchstring/i, @data ) { print $searchstring found\n; } This sorta worked. Needed a minor change. unless ( grep /$searchstring/i, @data ) { print $searchstring not found\n; Thanks. My apologies if I'm beating a dead horse here, but I'm new to Perl and thought of a slightly different approach: my $searchrx = qr/whatever/; # or q/whatever/ if you don't need regexp This is probably personal preference, but I prefer to provide a more meaningful name rather than using @ARGV. Plus you have lost the filename once you 'shifted' @ARGV in the open statement. May want to use the file name in the open error statement or later. I agree with you, saving the filename to a variable is probably a better practice, in general. In this context it wasn't specified that it was needed later, so I opted to just 'shift' it to use once. Also, I would not use the '/' as your quote delimiter - that's too recognizable as being used as the pattern match delimiter. Use actual double quotes () unless there are double quotes in the string - also less typing. Instead of '/' may want to use '{' and '}' if using qq (see perldoc perlop, Quote and Quote-like Operators). Good point. I started using generic quotes almost exclusively when I discovered that they avoided some of the possible shell-interpolation issues that arise when executing perl one-liners. I've probably taken it too far. I can see that '/' is not a great idea. Besides '{' and '}' as quote delimiters, do you think it's generally tolerated to use '(', ')', '[', ']' ? my $fileName = shift @ARGV or die You did not specify a filename\n; @ARGV or die qq/you didn't specify a filename\n/; Use lexical variable for filehandle. Makes things easier - such as passing to a function. open my $FH,'', $fileName or die Error opening $fileName: $!\n; open FH, q//, shift @ARGV or die qq/file open error: $!/; Okay, I'll work on breaking that habit. My first lessons in Perl used the open FH convention, and I just got used to it. The join is unnecessary, set the input_record_separator ($/) to undef or use a local copy of $/ (see perldoc perlvar). If this is undefined, the entire file will be read into a variable. Oh, I totally forgot about the input_record_separator ( $/ )... That's WAY better (actually when I wrote the 'join', I was thinking that I shouldn't need to do it that way!) Thanks much for the suggestions, Brian -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing File Contents
Uri Guttman wrote: BFY == Brian F Yulga byu...@langly.dyndns.org writes: BFY My apologies if I'm beating a dead horse here, but I'm new to Perl and BFY thought of a slightly different approach: BFY my $searchrx = qr/whatever/; # or q/whatever/ if you don't need regexp BFY @ARGV or die qq/you didn't specify a filename\n/; BFY open FH, q//, shift @ARGV or die qq/file open error: $!/; BFY $_ = join q//, FH; that is very slow and clunky. perl could slurp the file for you if you set $/ to undef. or better yet, use File::Slurp to do it Yes, definitely better to set $/ to undef. I'm still trying to get a handle on the libraries at my disposal -- There's so much in CPAN it's hard to know where to start. Is it equivalently efficient to use IO::All or IO::Simple, or is File::Slurp truly the best for this purpose? I ask because I played with IO:All to read files, enjoyed the simple, intuitive syntax my $filecontents io('filename'); , but (perhaps naively) assumed the native open my $fh to be faster since it doesn't require a use to load a library. BFY close FH; BFY if ( ! m/$searchrx/s ) { why are you using m//? the m isn't needed if you use // for delimiters Yeah, I know, I don't need it... being verbose (sometimes) keeps a newbie like me from making silly mistakes :-) My initial experimentation with Perl has been mostly in a line-by-line mind-set because I have a tendency to write scripts that are used like: some-unix-command | perl -wne 'do some processing' myresults.txt I'm trying to expand my horizons, thanks for help, Brian -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Bit testing
Hi Charles, On Sunday 14 November 2010 01:47:36 C.DeRykus wrote: On Nov 11, 11:27 pm, c...@pobox.com (Chap Harrison) wrote: Not lots shorter but you could use a closure to hide the calculation: my $mask; for my $flags ( ... ) { $mask = sub { return ($flags $_[0]) == $_[0] } unless $mask; given( $flags ) { when ( $mask-($one_and_three) ) { ... } when ( $mask-($zero_and_four) ) { ... } ... } } This won't work properly because the closure traps the initial value of $flags. For example: [code] #!/usr/bin/perl use strict; use warnings; my $closure; foreach my $name (qw(Sophie Jack Charles Dan Rachel)) { $closure = sub { print Hello $name!\n ; } unless $closure; $closure-(); } [/code] This prints Hello Sophie! five times. Either redeclare the closure on every iteration, or declare it once while using a more outer lexical variable. Regards, Shlomi Fish -- Charles DeRykus -- - Shlomi Fish http://www.shlomifish.org/ List of Portability Libraries - http://shlom.in/port-libs rindolf She's a hot chick. But she smokes. go|dfish She can smoke as long as she's smokin'. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Bit testing
On Nov 13, 3:47 pm, dery...@gmail.com (C.DeRykus) wrote: On Nov 11, 11:27 pm, c...@pobox.com (Chap Harrison) wrote: I'm almost embarrassed to ask this, but I can't figure out a simple way to construct a switch ('given') statement where the 'when' clauses involve bit-testing. Here's the only way I've figured out to build a switch statement that does the trick. It seems unusually wordy, which makes me think there must be a simpler way to test for certain bit combinations. Any suggestions? Thanks, Chap #!/usr/bin/perl use strict; use warnings; use feature :5.10; # Here are masks for various bit combos of interest: my $one_three = 0b1010; # bits 1 and 3 (counting from 0, right to left) my $zero_four = 0b00010001; # bits 0 and 4 my $five = 0b0010; # bit 5 # Here we will test several bit fields for bit combos of interest: for my $flags ( 0b10111010, 0b10111000, 0b10010010) { my $asbits = sprintf(0b%08b, $flags); # prepare bits for pretty-printing given ( $flags ) { when ( ($_ $one_three) == $one_three ) { # bits one and three are on say $asbits has bits 1 and 3; } when ( ($_ $zero_four) == $zero_four ) { # bits zero and four are on say $asbits has bits 0 and 4; } when ( ($_ $five) == $five ) { # bit five is on say $asbits has bit 5; } default { say $asbits has no interesting bit patterns.; } } } Not lots shorter but you could use a closure to hide the calculation: my $mask; for my $flags ( ... ) { $mask = sub { return ($flags $_[0]) == $_[0] } unless $mask; given( $flags ) { when ( $mask-($one_and_three) ) { ... } when ( $mask-($zero_and_four) ) { ... } ... } } Oops, right. The closure could've/should've been declared w/o a statement qualifier. And now it seems a little bit inelegant to redefine the closure each time through the loop. for my $flags ( ... ) { my $mask = sub { return ($flags $_[0]) == $_[0] }; given( $flags ) { when ( $mask-($one_and_three) ) { ... } when ( $mask-($zero_and_four) ) { ... } ... } ... -- Charles DeRykus
Re: Bit testing
On Nov 14, 2010, at 4:36 AM, C.DeRykus wrote: And now it seems a little bit inelegant to redefine the closure each time through the loop. for my $flags ( ... ) { my $mask = sub { return ($flags $_[0]) == $_[0] }; given( $flags ) { when ( $mask-($one_and_three) ) { ... } when ( $mask-($zero_and_four) ) { ... } ... } ... First, thanks for (($flags $mask) == $mask). What I eventually did was just call a subroutine on($flags, $mask) to do the calculation and determine whether all the specified bits were on. Seems simpler than the closure technique, even if having to repeatedly write '$flags' is less than ideal. However, now I'm determined to get an understanding of closures, and I see another thread on this list that provides several links to help in that regard. Thanks, one and all! Regards, Chap -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Bit testing
On Nov 14, 1:11 am, shlo...@iglu.org.il (Shlomi Fish) wrote: Hi Charles, On Sunday 14 November 2010 01:47:36 C.DeRykus wrote: On Nov 11, 11:27 pm, c...@pobox.com (Chap Harrison) wrote: Not lots shorter but you could use a closure to hide the calculation: my $mask; for my $flags ( ... ) { $mask = sub { return ($flags $_[0]) == $_[0] } unless $mask; given( $flags ) { when ( $mask-($one_and_three) ) { ... } when ( $mask-($zero_and_four) ) { ... } ... } } This won't work properly because the closure traps the initial value of $flags. For example: [code] #!/usr/bin/perl use strict; use warnings; my $closure; foreach my $name (qw(Sophie Jack Charles Dan Rachel)) { $closure = sub { print Hello $name!\n ; } unless $closure; $closure-();} [/code] This prints Hello Sophie! five times. Either redeclare the closure on every iteration, or declare it once while using a more outer lexical variable. Right... or simply get rid of the statement qualifier 'unless $closure' which'll work too and is what you'll have to do in any case. (technically, you could declare 'my $closure' both in/outside the loop leaving the statement qualifier as is but that's horrible ) You could just 'my $closure' solely inside the loop too. Declaring once outside the loop with an outer lexical seems less satisfactory since it loosens the 'tightest lexical scope' best practice. -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Bit testing
On Nov 11, 11:27 pm, c...@pobox.com (Chap Harrison) wrote: I'm almost embarrassed to ask this, but I can't figure out a simple way to construct a switch ('given') statement where the 'when' clauses involve bit-testing. Here's the only way I've figured out to build a switch statement that does the trick. It seems unusually wordy, which makes me think there must be a simpler way to test for certain bit combinations. Any suggestions? Thanks, Chap #!/usr/bin/perl use strict; use warnings; use feature :5.10; # Here are masks for various bit combos of interest: my $one_three = 0b1010; # bits 1 and 3 (counting from 0, right to left) my $zero_four = 0b00010001; # bits 0 and 4 my $five = 0b0010; # bit 5 # Here we will test several bit fields for bit combos of interest: for my $flags ( 0b10111010, 0b10111000, 0b10010010) { my $asbits = sprintf(0b%08b, $flags); # prepare bits for pretty-printing given ( $flags ) { when ( ($_ $one_three) == $one_three ) { # bits one and three are on say $asbits has bits 1 and 3; } when ( ($_ $zero_four) == $zero_four ) { # bits zero and four are on say $asbits has bits 0 and 4; } when ( ($_ $five) == $five ) { # bit five is on say $asbits has bit 5; } default { say $asbits has no interesting bit patterns.; } } } Not lots shorter but you could use a closure to hide the calculation: my $mask; for my $flags ( ... ) { $mask = sub { return ($flags $_[0]) == $_[0] } unless $mask; given( $flags ) { when ( $mask-($one_and_three) ) { ... } when ( $mask-($zero_and_four) ) { ... } ... } } -- Charles DeRykus
Bit testing
I'm almost embarrassed to ask this, but I can't figure out a simple way to construct a switch ('given') statement where the 'when' clauses involve bit-testing. Here's the only way I've figured out to build a switch statement that does the trick. It seems unusually wordy, which makes me think there must be a simpler way to test for certain bit combinations. Any suggestions? Thanks, Chap #!/usr/bin/perl use strict; use warnings; use feature :5.10; # Here are masks for various bit combos of interest: my $one_three= 0b1010; # bits 1 and 3 (counting from 0, right to left) my $zero_four= 0b00010001; # bits 0 and 4 my $five = 0b0010; # bit 5 # Here we will test several bit fields for bit combos of interest: for my $flags ( 0b10111010, 0b10111000, 0b10010010) { my $asbits = sprintf(0b%08b, $flags); # prepare bits for pretty-printing given ( $flags ) { when ( ($_ $one_three) == $one_three ) { # bits one and three are on say $asbits has bits 1 and 3; } when ( ($_ $zero_four) == $zero_four ) { # bits zero and four are on say $asbits has bits 0 and 4; } when ( ($_ $five) == $five ) { # bit five is on say $asbits has bit 5; } default { say $asbits has no interesting bit patterns.; } } } -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Bit testing
CH == Chap Harrison c...@pobox.com writes: CH I'm almost embarrassed to ask this, but I can't figure out a CH simple way to construct a switch ('given') statement where the CH 'when' clauses involve bit-testing. Here's the only way I've CH figured out to build a switch statement that does the trick. It CH seems unusually wordy, which makes me think there must be a CH simpler way to test for certain bit combinations. Any CH suggestions? CH when ( ($_ $one_three) == $one_three ) { # bits one and CH three are on don't put comments on the same line as code. it can make it line wrap like above. anyhow, some boolean hacking does the trick. this seems to work. when ( !(~$_ $one_three) ) you invert the flag bits and then and against the test mask. if that is all 0's (tested with !) then your bits were set. uri -- Uri Guttman -- u...@stemsystems.com http://www.sysarch.com -- - Perl Code Review , Architecture, Development, Training, Support -- - Gourmet Hot Cocoa Mix http://bestfriendscocoa.com - -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
testing tcp connection
Hi All, I have an issue when something goes wrong with the client that's trying to connect. 9 out of 10 times this works fine, but there are odd situations where $clientip doesn't get filled in, which leaves me with a connection I can't do anything with... I tried to use close($client) to just terminate these odd connections when $clientip is empty but that doesn't work.. The program keeps running but these 'zombie' connections will eventually fill up my system. Just a small snip of the program... #!/usr/bin/perl -w use strict; use IO::Socket qw(:DEFAULT :crlf); my $server = IO::Socket::INET-new(Proto=tcp, LocalPort=$port, Listen=$maxconn, Reuse=1, Timeout=300) or die Can't setup server\n; while ( $client = $server-accept()) { $clientip = $client-peerhost(); $clienthost = gethostbyaddr($client-peeraddr,AF_INET); # Some other stuff } Thanks for any tips! - Marco van Kammen Springer Science+Business Media System Manager Postmaster - van Godewijckstraat 30 | 3311 GX Office Number: 05E21 Dordrecht | The Netherlands - tel +31(78)6576446 fax +31(78)6576302 - www.springeronline.com http://www.springeronline.com www.springer.com http://www.springer.com/ -
AW: testing tcp connection
Kammen van, Marco, Springer SBM NL marco.vankam...@springer.com asked: I have an issue when something goes wrong with the client that's trying to connect. 9 out of 10 times this works fine, but there are odd situations where $clientip doesn't get filled in, which leaves me with a connection I can't do anything with... I tried to use close($client) to just terminate these odd connections when $clientip is empty but that doesn't work.. From my understanding of sockets (strictly limited ;-)) you'll need to call $client-shutdown( $how ): From perlfunc: shutdown SOCKET,HOW Shuts down a socket connection in the manner indicated by HOW, which has the same interpretation as in the system call of the same name. shutdown(SOCKET, 0);# I/we have stopped reading data shutdown(SOCKET, 1);# I/we have stopped writing data shutdown(SOCKET, 2);# I/we have stopped using this socket This is useful with sockets when you want to tell the other side you're done writing but not done reading, or vice versa. It's also a more insistent form of close because it also disables the file descriptor in any forked copies in other processes. HTH, Thomas -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
RE: testing tcp connection
-Original Message- From: Thomas Bätzler [mailto:t.baetz...@bringe.com] Sent: Wednesday, September 01, 2010 8:57 AM To: beginners@perl.org Cc: Kammen van, Marco, Springer SBM NL Subject: AW: testing tcp connection Kammen van, Marco, Springer SBM NL marco.vankam...@springer.com asked: I have an issue when something goes wrong with the client that's trying to connect. 9 out of 10 times this works fine, but there are odd situations where $clientip doesn't get filled in, which leaves me with a connection I can't do anything with... I tried to use close($client) to just terminate these odd connections when $clientip is empty but that doesn't work.. From my understanding of sockets (strictly limited ;-)) you'll need to call $client-shutdown( $how ): From perlfunc: shutdown SOCKET,HOW Shuts down a socket connection in the manner indicated by HOW, which has the same interpretation as in the system call of the same name. shutdown(SOCKET, 0);# I/we have stopped reading data shutdown(SOCKET, 1);# I/we have stopped writing data shutdown(SOCKET, 2);# I/we have stopped using this socket This is useful with sockets when you want to tell the other side you're done writing but not done reading, or vice versa. It's also a more insistent form of close because it also disables the file descriptor in any forked copies in other processes. HTH, Thomas Thanks Thomas, this seems exactly the thing I'm looking for! I'll give this a go! Marco. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: testing if divisible by?
On Sat, May 1, 2010 at 7:45 AM, Philip Potter philip.g.pot...@gmail.com wrote: On 1 May 2010 12:15, Paul opensou...@unixoses.com wrote: Hello all. How can I test to see if a number is divisible by say, 40? Thanks. Use the modulo operator %. Given integers $x and $y, the expression $x % $y gives the remainder when $x is divided by $y. As a result, if (and only if) $x is exactly divisible by $y, $x % $y is equal to 0. And there's the rub: number ne integer. % is fine if you're only interested in integers, but if you want to compare other numbers use fmod() from POSIX.pm: perl -MPOSIX -wle 'print POSIX::fmod(35, 17.5)' It's considerably slower than %, but it gets the job done. HTH, -- jay -- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org values of β will give rise to dom! -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: testing if divisible by?
2010/5/3 Jay Savage daggerqu...@gmail.com: On Sat, May 1, 2010 at 7:45 AM, Philip Potter philip.g.pot...@gmail.com wrote: On 1 May 2010 12:15, Paul opensou...@unixoses.com wrote: Hello all. How can I test to see if a number is divisible by say, 40? Use the modulo operator %. Given integers $x and $y, the expression $x And there's the rub: number ne integer. % is fine if you're only interested in integers, but if you want to compare other numbers use fmod() from POSIX.pm: perl -MPOSIX -wle 'print POSIX::fmod(35, 17.5)' fmod is a fine replacement for % in general for testing remainders of floating-point valued quotients, but using it as a divisibility test requires caution and serious consideration of a different approach. It has the same issues as a floating-point equality test: that is, because floating-point is an inexact representation, the results can depend on whether a value was rounded up or down: D:\perl -MPOSIX -wle print POSIX::fmod(0.2, 0.1) 0 D:\perl -MPOSIX -wle print POSIX::fmod(0.3, 0.1) 0.1 D:\perl -MPOSIX -wle print POSIX::fmod(0.4, 0.1) 0 D:\perl -MPOSIX -wle print POSIX::fmod(0.5, 0.1) 0.1 These examples have strange results because 0.1 is not exactly representable in binary floating-point. Phil -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
testing if divisible by?
Hello all. How can I test to see if a number is divisible by say, 40? Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: testing if divisible by?
Paul wrote: Hello all. How can I test to see if a number is divisible by say, 40? Thanks. See `perldoc perlop` and search for /Multiplicative Operators/ Read the part about the % operator. -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. I like Perl; it's the only language where you can bless your thingy. Eliminate software piracy: use only FLOSS. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: testing if divisible by?
On 1 May 2010 12:15, Paul opensou...@unixoses.com wrote: Hello all. How can I test to see if a number is divisible by say, 40? Thanks. Use the modulo operator %. Given integers $x and $y, the expression $x % $y gives the remainder when $x is divided by $y. As a result, if (and only if) $x is exactly divisible by $y, $x % $y is equal to 0. #!perl use 5.010; # for 'say' say 5 % 2; say 6 % 2; say 7 % 2; say 79 % 40; say 80 % 40; say 81 % 40; For more information, see http://perldoc.perl.org/perlop.html#Multiplicative-Operators Phil -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: testing if divisible by?
On Sat, 2010-05-01 at 07:15 -0400, Paul wrote: Hello all. How can I test to see if a number is divisible by say, 40? Use the modulo operator: my $a = 40; my $b = 1; if ($a % $b == 0) { print $b is divisible by $a\n; } -j -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: testing if divisible by?
JLP == Jamie L Penman-Smithson li...@silverdream.org writes: JLP On Sat, 2010-05-01 at 07:15 -0400, Paul wrote: Hello all. How can I test to see if a number is divisible by say, 40? JLP Use the modulo operator: JLP my $a = 40; JLP my $b = 1; JLP if ($a % $b == 0) { no need for the == 0 if you invert the test with unless or change the print text. JLP print $b is divisible by $a\n; JLP } uri -- Uri Guttman -- u...@stemsystems.com http://www.sysarch.com -- - Perl Code Review , Architecture, Development, Training, Support -- - Gourmet Hot Cocoa Mix http://bestfriendscocoa.com - -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Testing with Perl and Selenium RC
Does anyone here know where I can find information about using Perl to run tests with Selenium Remote Control? There is no Perl specific information in their documentation or SDK and they don't appear to have any Perl developers involved in the project any more. I pasted together some of my notes in a page on their wiki http://wiki.openqa.org/display/SRC/Selenium+RC+and+Perl, but it's not a very good explanation of how to do it. Thank you, Bob McConnell -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
RE: Testing with Selenium
From: Steve Bertrand Steve Bertrand wrote: Bob McConnell wrote: I have begun the task of automating functional tests for some of our web servers. I have had some success using Selenium IDE in Firefox to capture input sequences, exporting them to Perl scripts, then using the Se remote control server to execute them. But I have run into one minor problem. A basic test is to verify the error message returned when an invalid password is entered. This test script is shown below. I can run this as a simple test, or it can be part of a suite. The command line to manually run the suite is normally: perl -MTest::Harness -e @ARGV= map glob, @ARGV \ if $^O =~ /^MSWin/; runtests @ARGV; test/*.pl Unfortunately, yes this is running on a WinXP system. My problem is that we have multiple virtual hosts on that server, and I need to select a specific host for each run. So when I run the harness I need some way to pass the tst12.dev portion of the URL into each of the test scripts. I can't see any way with Test::Harness or Test::More to do this. If I can, then I have other parameters that need to be passed in as well. Do I understand you correctly in believing that you are trying to run specific tests against numerous hosts within a single test file? Appears as though I've totally misunderstood what you are after... After re-reading, it looks as though you are trying to execute multiple test 'files', and want to supply the hostname (and perhaps other params) into them. Yes? Yes, I have a 'tests' directory with a growing number of Selenium scripts that will become an automated regression test. Each time I run those scripts with Test::Harness I need to pass a server name to each script. There are other variables I would also like to control. On my test server there are three hosts that I maintain, which normally have the current and two previous builds of the application. After I add or modify a test script, or make a change to the current version, if there is a test failure I can then run the same test on the previous versions to find out if they produce the same failure. These test scripts will be checked into our SCM so the QA and production teams have access to them as well. In addition, those teams should be able to record and add scripts that recreate problems they find or any that are reported by clients. Once fixed, those tests will also become part of the regression suite. This reduces the time to run a reasonably complete regression test from most of a man-week to a couple of hours. Paul's suggestion of environment variables appears to be the only viable option I have seen so far. Bob McConnell -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Testing with Selenium
Good morning, I have begun the task of automating functional tests for some of our web servers. I have had some success using Selenium IDE in Firefox to capture input sequences, exporting them to Perl scripts, then using the Se remote control server to execute them. But I have run into one minor problem. A basic test is to verify the error message returned when an invalid password is entered. This test script is shown below. I can run this as a simple test, or it can be part of a suite. The command line to manually run the suite is normally: perl -MTest::Harness -e @ARGV= map glob, @ARGV \ if $^O =~ /^MSWin/; runtests @ARGV; test/*.pl Unfortunately, yes this is running on a WinXP system. My problem is that we have multiple virtual hosts on that server, and I need to select a specific host for each run. So when I run the harness I need some way to pass the tst12.dev portion of the URL into each of the test scripts. I can't see any way with Test::Harness or Test::More to do this. If I can, then I have other parameters that need to be passed in as well. Any suggestions? Bob McConnell --8 # Check for invalid password use strict; use warnings; use Time::HiRes qw(sleep); use Test::WWW::Selenium; use Test::More no_plan; # currently 9 tests use Test::Exception; # The SeRC server must already be running in another process. my $sel = Test::WWW::Selenium-new( host = localhost, port = , browser = *chrome, browser_url = http://tst12.dev.managemyid.com/; ); $sel-open_ok(http://tst12.dev.managemyid.com/;); $sel-set_speed(1000);# without this line, everything will error out. $sel-wait_for_page_to_load_ok(1); $sel-type_ok(LoginID, devmmi...@tpsmail.dev); $sel-type_ok(LoginPWD, password); $sel-click_ok(LoginSubmit); $sel-wait_for_page_to_load_ok(1); like($sel-get_title(), qr/ManageMyID.com - Login/, Login failed); cmp_ok ($sel-get_text(css=div[class=Error]), =~, Invalid Email Address and / or Password for, Correct error message); --8 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing with Selenium
Bob McConnell wrote: Good morning, I have begun the task of automating functional tests for some of our web servers. I have had some success using Selenium IDE in Firefox to capture input sequences, exporting them to Perl scripts, then using the Se remote control server to execute them. But I have run into one minor problem. A basic test is to verify the error message returned when an invalid password is entered. This test script is shown below. I can run this as a simple test, or it can be part of a suite. The command line to manually run the suite is normally: perl -MTest::Harness -e @ARGV= map glob, @ARGV \ if $^O =~ /^MSWin/; runtests @ARGV; test/*.pl Unfortunately, yes this is running on a WinXP system. My problem is that we have multiple virtual hosts on that server, and I need to select a specific host for each run. So when I run the harness I need some way to pass the tst12.dev portion of the URL into each of the test scripts. I can't see any way with Test::Harness or Test::More to do this. If I can, then I have other parameters that need to be passed in as well. Do I understand you correctly in believing that you are trying to run specific tests against numerous hosts within a single test file? If so, I do the same sort of thing. I loop through a pre-determined number of items, and after each loop completes, reset the data: my @bad_hours = qw ( a x $ 8p p8 $8 hello %hash ); for ( @bad_hours ) { $plan_info{ hours } = $_; my $return = $user-add_plan( \%plan_info, $error ); isa_ok ( $return, 'ISP::Error', $_ in the hrs field, the return ); _reset(); } The _reset() function essentially undefs all existing params and objects, and re-initializes them to an original state. If you needed to loop in multiple variables, you could perhaps change the construct to pass in differing anon hashes instead, and de-construct and assign the values within the loop. my @data = ( { hostname = 'name', port = 8080, }, { hostname = 'blah', port = 9010, }, ); Am I on the right track as to what you are after? If so, you could also change the setup so that the core test is in a sub, and instead of looping around the code, you could just loop around a sub call instead: for my $data_href ( @data ) { test_function( $href ); } Steve smime.p7s Description: S/MIME Cryptographic Signature
Re: Testing with Selenium
Steve Bertrand wrote: Bob McConnell wrote: Good morning, I have begun the task of automating functional tests for some of our web servers. I have had some success using Selenium IDE in Firefox to capture input sequences, exporting them to Perl scripts, then using the Se remote control server to execute them. But I have run into one minor problem. A basic test is to verify the error message returned when an invalid password is entered. This test script is shown below. I can run this as a simple test, or it can be part of a suite. The command line to manually run the suite is normally: perl -MTest::Harness -e @ARGV= map glob, @ARGV \ if $^O =~ /^MSWin/; runtests @ARGV; test/*.pl Unfortunately, yes this is running on a WinXP system. My problem is that we have multiple virtual hosts on that server, and I need to select a specific host for each run. So when I run the harness I need some way to pass the tst12.dev portion of the URL into each of the test scripts. I can't see any way with Test::Harness or Test::More to do this. If I can, then I have other parameters that need to be passed in as well. Do I understand you correctly in believing that you are trying to run specific tests against numerous hosts within a single test file? Appears as though I've totally misunderstood what you are after... After re-reading, it looks as though you are trying to execute multiple test 'files', and want to supply the hostname (and perhaps other params) into them. Yes? Steve smime.p7s Description: S/MIME Cryptographic Signature
Re: Testing with Selenium
On Tue, Sep 22, 2009 at 02:12:31PM -0400, Bob McConnell wrote: Good morning, I have begun the task of automating functional tests for some of our web servers. I have had some success using Selenium IDE in Firefox to capture input sequences, exporting them to Perl scripts, then using the Se remote control server to execute them. But I have run into one minor problem. My problem is that we have multiple virtual hosts on that server, and I need to select a specific host for each run. So when I run the harness I need some way to pass the tst12.dev portion of the URL into each of the test scripts. I can't see any way with Test::Harness or Test::More to do this. If I can, then I have other parameters that need to be passed in as well. Any suggestions? I solve exactly this problem by using environment variables. You can also provide a default in your test if that makes sense. -- Paul Johnson - p...@pjcj.net http://www.pjcj.net -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Testing a scalier for two possible values at once
I need to test a scalier to see if its value is not two possibilities, because this test is being done inside a while loop I can not use an elsif statement without things getting ugly. I have tried it like this if ($scalier nq 'A') || ($scalier nq 'B') { but that just gave me a syntax error when I tried to run it. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing a scalier for two possible values at once
You wrote on 05/13/2009 02:17 AM: I need to test a scalier to see if its value is not two possibilities, because this test is being done inside a while loop I can not use an elsif statement without things getting ugly. I have tried it like this if ($scalier nq 'A') || ($scalier nq 'B') { but that just gave me a syntax error when I tried to run it. It's ne not nq. hth Alex -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing a scalier for two possible values at once
On Wed, May 13, 2009 at 11:25:40AM +0200, Alexander Koenig wrote: You wrote on 05/13/2009 02:17 AM: I need to test a scalier to see if its value is not two possibilities, because this test is being done inside a while loop I can not use an elsif statement without things getting ugly. I have tried it like this if ($scalier nq 'A') || ($scalier nq 'B') { but that just gave me a syntax error when I tried to run it. It's ne not nq. You'll also need to get your logic correct or you might find that reducing to if (1) {} -- Paul Johnson - p...@pjcj.net http://www.pjcj.net -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing a scalier for two possible values at once
Adam Jimerson wrote: I need to test a scalier to see if its value is not two possibilities, because this test is being done inside a while loop I can not use an elsif statement without things getting ugly. I have tried it like this if ($scalier nq 'A') || ($scalier nq 'B') { but that just gave me a syntax error when I tried to run it. That should be: if ( $scalier ne 'A' $scalier ne 'B' ) { John -- Those people who think they know everything are a great annoyance to those of us who do.-- Isaac Asimov -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: disk performance or destructive testing
On Dec 17, 1:31 am, ben.pe...@gmail.com (Ben Perl) wrote: Does anyone know any perl module for validating or do some desctructive testing on disks on Linux platform? found a few constructive ones, but nothing that would be destructive. i doubt that you would find any at CPAN. check if any of these are helpful for you: Sys::Statistics::Linux::DiskStats Sys::Statistics::Linux::DiskUsage Filesys::Df cheers yogesh -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
disk performance or destructive testing
Does anyone know any perl module for validating or do some desctructive testing on disks on Linux platform? Thanks, -Ben
Unit testing
Hi All! I need to add unit tests to my project which I will start soon. I'm using latest ActivePerl in Win32 (because I have to) and I installed Test::Unit::Lite through ppm.bat. But! When I tried to run example test: #!/usr/bin/perl -w use strict; use warnings; use File::Basename; use File::Spec; use Cwd; BEGIN { chdir dirname(__FILE__) or die $!; chdir '..' or die $!; unshift @INC, map { /(.*)/; $1 } split(/:/, $ENV{PERL5LIB}) if ${^TAINT}; my $cwd = ${^TAINT} ? do { local $_=getcwd; /(.*)/; $1 } : '.'; unshift @INC, File::Spec-catdir($cwd, 'inc'); unshift @INC, File::Spec-catdir($cwd, 'lib'); } use Test::Unit::Lite; local $SIG{__WARN__} = sub { require Carp; Carp::confess(Warning: $_[0]) }; all_tests; Warning: Can't stat t\tlib: No such file or directory at C:/Perl/site/lib/Test/Unit/Lite.pm line 775 at C:\Slavik\Projects\PerlProjects\SuccessText.pl line 22 main::__ANON__('Can\'t stat t\tlib: No such file or directory\x{a} at C:/Perl/sit...') called at C:/Perl/lib/Carp.pm line 46 Carp::carp('Can\'t stat t\tlib: No such file or directory\x{a}') called at C:/Perl/lib/warnings.pm line 499 warnings::warnif() called at C:/Perl/lib/File/Find.pm line 712 File::Find::_find_opt('HASH(0x19e71c4)', 't\tlib') called at C:/Perl/lib/File/Find.pm line 1286 File::Find::find('HASH(0x19e71c4)', 't\tlib') called at C:/Perl/site/lib/Test/Unit/Lite.pm line 775 Test::Unit::Lite::AllTests::suite('Test::Unit::Lite::AllTests') called at C:/Perl/site/lib/Test/Unit/Lite.pm line 680 Test::Unit::TestRunner::start('Test::Unit::TestRunner=HASH(0x229cd4)', 'Test::Unit::Lite::AllTests') called at C:/Perl/site/lib/Test/Unit/Lite.pm line 116 Test::Unit::Lite::all_tests() called at C:\Slavik\Projects\PerlProjects\SuccessText.pl line 24 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Testing for a condition immediately after require
I want to be able to tag a module with one or more tags that can be tested for after requiring it. nbsp; require 'module'; lt;test for existence of tags in 'module'gt; nbsp; Any ideas on the best way to accomplish this? nbsp; Thanks in advance nbsp;
Re: Testing an array for a match
Lou Hernsen wrote: Hallo Hello, I have an array @Treasures and I want to match anywhere in it for /:1:2:3:/ can I if (@Treasures =~ /:1:2:3:/){} or do i have to change (@Treasures to $Treasures and then $Treasures = @Treasures ; if ($Treasures =~ /:1:2:3:/){} if ( grep /:1:2:3:/, @Treasures ) { John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order.-- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Testing an array for a match
Hallo I have an array @Treasures and I want to match anywhere in it for /:1:2:3:/ can I if (@Treasures =~ /:1:2:3:/){} or do i have to change (@Treasures to $Treasures and then $Treasures = @Treasures ; if ($Treasures =~ /:1:2:3:/){} Just thought I'd ask first, I have to take mother in law to Dr. so I don't have time to test right now... I'll check email in a few hours... thanks Lou -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Testing an array for a match
On Thu, Apr 10, 2008 at 1:07 AM, Lou Hernsen [EMAIL PROTECTED] wrote: Hallo I have an array @Treasures and I want to match anywhere in it for /:1:2:3:/ can I if (@Treasures =~ /:1:2:3:/){} or do i have to change (@Treasures to $Treasures and then $Treasures = @Treasures ; if ($Treasures =~ /:1:2:3:/){} You can use a 'grep', like: use strict; my @x = (11,22, ':1:2:3:xxx', 'ab','cd', 'test:1:2:3:dd:ee'); my @seen = grep {/:1:2:3:/} @x; print @seen; Good luck with your family. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Testing an array for a match
Hi, How about this :- foreach (@Treasures){ if ($_=~ /:1:2:3:/){ print do your stuffs here\n: } } - Original Message - From: Lou Hernsen [EMAIL PROTECTED] To: beginners@perl.org; [EMAIL PROTECTED] Sent: Thursday, April 10, 2008 1:07 AM Subject: Testing an array for a match Hallo I have an array @Treasures and I want to match anywhere in it for /:1:2:3:/ can I if (@Treasures =~ /:1:2:3:/){} or do i have to change (@Treasures to $Treasures and then $Treasures = @Treasures ; if ($Treasures =~ /:1:2:3:/){} Just thought I'd ask first, I have to take mother in law to Dr. so I don't have time to test right now... I'll check email in a few hours... thanks Lou -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Testing an array for a match
Hallo I have an array @Treasures and I want to match anywhere in it for /:1:2:3:/ can I if (@Treasures =~ /:1:2:3:/){} or do i have to change (@Treasures to $Treasures and then $Treasures = @Treasures ; if ($Treasures =~ /:1:2:3:/){} Just thought I'd ask first, I have to take mother in law to Dr. so I don't have time to test right now... I'll check email in a few hours... thanks Lou -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
testing Non_SOAP webservices
Hi gurus, I need to test non-SOAP webservices.Can anybody tell how could i do that in perl. basically i need to send the following xml file as pay load to the url. - ?xml version='1.0' encoding='UTF-8'? ns1:getHelloResp xmlns:ns1=http://sample2/xsd; ns1:req ns1:type=samples.HelloReq ns1:nameNag/ns1:name ns1:count3/ns1:count /ns1:req /ns1:getHelloResp --- and get the response can anybody in the group help me in doing this using perl. thanks, Siva --
Re: testing Non_SOAP webservices
From: perl pra [EMAIL PROTECTED] Hi gurus, I need to test non-SOAP webservices.Can anybody tell how could i do that in perl. basically i need to send the following xml file as pay load to the url. Have a look at the LWP modules. You'll need either LWP::Simple or LWP::UserAgent. Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: testing for a file type
On Dec 19, 2007 7:01 PM, Jenda Krynicky [EMAIL PROTECTED] wrote: snip I did not install it yet so I can't check but I think you have it wrong. According to the docs you point to @ARGV ~~ /\.mdb\z/ is equivalent to grep /\.mdb\z/, @ARGV which is true whenever at least one item in the array matches the regexp. snip Yeah, I jumped the gun. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: testing for a file type
On Dec 18, 2007 4:49 PM, Rob Dixon [EMAIL PROTECTED] wrote: snip if (grep { not /\.mdb\z/ } @ARGV) { print All parameters must be MDB files\n; exit; } snip Or in Perl 5.10, coming to stores near you soon*, you can use the smart match operator: @ARGV ~~ /\.mdb\z/ or die All parameters must be MDB files See smart matching in perldoc perlsyn or http://search.cpan.org/dist/perl/pod/perlsyn.pod#Smart_matching_in_detail * I just checked and in fact it was released yesterday. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: testing for a file type
From: Chas. Owens [EMAIL PROTECTED] On Dec 18, 2007 4:49 PM, Rob Dixon [EMAIL PROTECTED] wrote: snip if (grep { not /\.mdb\z/ } @ARGV) { print All parameters must be MDB files\n; exit; } snip Or in Perl 5.10, coming to stores near you soon*, you can use the smart match operator: @ARGV ~~ /\.mdb\z/ or die All parameters must be MDB files See smart matching in perldoc perlsyn or http://search.cpan.org/dist/perl/pod/perlsyn.pod#Smart_matching_in_detail * I just checked and in fact it was released yesterday. I did not install it yet so I can't check but I think you have it wrong. According to the docs you point to @ARGV ~~ /\.mdb\z/ is equivalent to grep /\.mdb\z/, @ARGV which is true whenever at least one item in the array matches the regexp. So it would be @ARGV ~~ /\.mdb\z/ or die At least one of the parameters must be an MDB file; Probably not what Rob (or whoever posted the original post) intended. grep {not condition} @ARRAY is not equivalent to not grep {condition} @ARRAY not even in boolean context. @ARGV ~~ /\.mdb\z/ is any(@ARGV) =~ /\.mdb\z/ not all(@ARGV) =~ /\.mdb\z/ I think there should have been a !~~ operator as well. Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
testing for a file type
Hi, If I have: ... foreach (@ARGV) { print do something only to .mdb files; } I could use File::Basename's fileparse and test for the file extension and put a big if statement around or in the foreach loop. So if a user puts a non .mdb file argument on the cmd line it won't process and prints a usage. But I suspect in perl theres a more compact way of doing that? Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: testing for a file type
On Dec 18, 2007 10:08 PM, goldtech [EMAIL PROTECTED] wrote: Hi, If I have: ... foreach (@ARGV) { print do something only to .mdb files; } I could use File::Basename's fileparse and test for the file extension and put a big if statement around or in the foreach loop. So if a user puts a non .mdb file argument on the cmd line it won't process and prints a usage. But I suspect in perl theres a more compact way of doing that? I don't think you need to use File::Basename. You can simply do this. foreach my $file (@ARGV) { if ( $file !~ /\.mdb$/ ) { print $file is not a mdb file. Ignoring...\n; next; } # code to pocess .mdb file ... ... } -- Ankur -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: testing for a file type
goldtech wrote: Hi, If I have: ... foreach (@ARGV) { print do something only to .mdb files; } I could use File::Basename's fileparse and test for the file extension and put a big if statement around or in the foreach loop. So if a user puts a non .mdb file argument on the cmd line it won't process and prints a usage. But I suspect in perl theres a more compact way of doing that? use strict; use warnings; if (grep { not /\.mdb\z/ } @ARGV) { print All parameters must be MDB files\n; exit; } foreach (@ARGV) { print do something only to .mdb files; } HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
testing if hardware is avalible
Hi can you advise on the best way test if a usb modem is plugged in ? I though about checking if the file/node /dev/ttyACM0 is present, as it's created when the device is plugged in using open (TEST, /dev/tty/ACM0); but just concecned if i do this while the device is acitive it will cause it to drop the connection... What is the best methode for this ?? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: testing if hardware is avalible
On 7/19/07, Gregory Machin [EMAIL PROTECTED] wrote: can you advise on the best way test if a usb modem is plugged in ? I'd look at the socket. But if you're trying to do this via Perl, the best answer is the same way you'd do it via C, INTERCAL, or any other language. In other words, you may need to ask in a forum about usb devices, instead of one about Perl. Once you know what low-level operation will give you your answer, we can help you find a way to do that from Perl. I though about checking if the file/node /dev/ttyACM0 is present, as it's created when the device is plugged in using open (TEST, /dev/tty/ACM0); but just concecned if i do this while the device is acitive it will cause it to drop the connection... Maybe you could use a filetest to do what you want? Perhaps -e or even -c? my $modem_port = '/dev/tty/ACM0'; die Modem not found on '$modem_port' unless -c $modem_port; Good luck with it! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: testing if hardware is avalible
On 7/20/07, Gregory Machin [EMAIL PROTECTED] wrote: Hi can you advise on the best way test if a usb modem is plugged in ? I though about checking if the file/node /dev/ttyACM0 is present, as it's created when the device is plugged in using open (TEST, /dev/tty/ACM0); but just concecned if i do this while the device is acitive it will cause it to drop the connection... What is the best methode for this ?? This is highly OS dependent; however, most OSes provide a utility like ifconfig that can report on the status of network interfaces. Another option (at least under many UNIX flavors) is to use lsof (list open files) to check to see if the file is already open: #!/usr/bin/perl use strict; use warnings; $! = 0; if (my $out = `lsof $ARGV[0]`) { die $out if $?; print $ARGV[0] is open\n; } else { print $ARGV[0] is closed\n; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
DBD::Oracle for perl testing issues
I am attempting to install DBD::Oracle for Perl. I am having some difficulties though. During the make test procedure a number of my tests fail. One of them is the 10general.t test. It fails on lines 31 and 32 which has is system(exit 1;), 18, 'system exit 1 should return 256'; is system(exit 0;), 0, 'system exit 0 should return 0'; The errors states that both lines return a value of -1 instead of 256 and 0 respectively. I don't understand why it would return such a thing because as far as I can tell it should be returning the correct value. I am using a Unix system with Solaris 9 and Oracle 10 installed. Thanks for any help offerened -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: DBD::Oracle for perl testing issues
On 7/5/07, Dan King [EMAIL PROTECTED] wrote: I am attempting to install DBD::Oracle for Perl. I am having some difficulties though. During the make test procedure a number of my tests fail. One of them is the 10general.t test. It fails on lines 31 and 32 which has is system(exit 1;), 18, 'system exit 1 should return 256'; is system(exit 0;), 0, 'system exit 0 should return 0'; The errors states that both lines return a value of -1 instead of 256 and 0 respectively. This doesn't look like a problem with Oracle, but instead a problem with perl or your OS. Could there be a program on your system with the unfortunate name of 'exit'? Could your perl binary be misconfigured? Did it pass all tests before installation? Good luck with it! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
testing return values
Hiya. I'm looking for the correct Perl style for testing and storing a return value in a control statement. The solution in any other language is pretty obvious, but I get the distinct impression that there's a 'right' way in Perl... Let's say I want to test a scalar returned from a subroutine, and also keep a copy for my own use: $scalar = sub( $argument ); if( $scalar ){ } Naturally that's no big deal. Now let's say I have a tree I want to traverse, or some similar open-ended thing to evaluate, and want to run it until a condition is reached.. while( read_tree( $argument ){ } Again no biggie. The problem is if I want to keep the result. Obviously I can't do this: while( $tree_element = read_tree( $argument ) ){ do_something( $tree_element ); } I can come up with a brute-force solution of course, but there's probably a better, Perlish way that I'm not aware of. In addition, I don't expect a return value from some module to be consistently undefined or zero; it could change under some circumstances. This makes me think that the problem has been dealt with long ago, and just doesn't stick out in the llama/alpaca/whatever books. Hopefully I explained this correctly! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: testing return values
Now, why can't you do this? while( $tree_element = read_tree( $argument ) ){ do_something( $tree_element ); } I would certainly use it. In C this is called operation overflow or something... On 4/22/07, Mike Lesser [EMAIL PROTECTED] wrote: Hiya. I'm looking for the correct Perl style for testing and storing a return value in a control statement. The solution in any other language is pretty obvious, but I get the distinct impression that there's a 'right' way in Perl... Let's say I want to test a scalar returned from a subroutine, and also keep a copy for my own use: $scalar = sub( $argument ); if( $scalar ){ } Naturally that's no big deal. Now let's say I have a tree I want to traverse, or some similar open-ended thing to evaluate, and want to run it until a condition is reached.. while( read_tree( $argument ){ } Again no biggie. The problem is if I want to keep the result. Obviously I can't do this: while( $tree_element = read_tree( $argument ) ){ do_something( $tree_element ); } I can come up with a brute-force solution of course, but there's probably a better, Perlish way that I'm not aware of. In addition, I don't expect a return value from some module to be consistently undefined or zero; it could change under some circumstances. This makes me think that the problem has been dealt with long ago, and just doesn't stick out in the llama/alpaca/whatever books. Hopefully I explained this correctly! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: testing return values
Mike Lesser wrote: Hiya. I'm looking for the correct Perl style for testing and storing a return value in a control statement. The solution in any other language is pretty obvious, but I get the distinct impression that there's a 'right' way in Perl... Let's say I want to test a scalar returned from a subroutine, and also keep a copy for my own use: $scalar = sub( $argument ); if( $scalar ){ } Naturally that's no big deal. Now let's say I have a tree I want to traverse, or some similar open-ended thing to evaluate, and want to run it until a condition is reached.. while( read_tree( $argument ){ } Again no biggie. The problem is if I want to keep the result. Obviously I can't do this: while( $tree_element = read_tree( $argument ) ){ do_something( $tree_element ); } I can come up with a brute-force solution of course, but there's probably a better, Perlish way that I'm not aware of. In addition, I don't expect a return value from some module to be consistently undefined or zero; it could change under some circumstances. This makes me think that the problem has been dealt with long ago, and just doesn't stick out in the llama/alpaca/whatever books. Hopefully I explained this correctly! while (my $x = func()) { : } is perfectly valid. In Perl every operator returns a value, and the assignment operator is no exception. It's value is the expression on the left of the equals sign, and it's even an lvalue so you can do things like ($x = 3)++; leaving $x with a value of four. This sort of thing is more useful for things like $p = $q = 'A'; which is the same as $p = ($q = 'A'); or $q = 'A'; $p = $q; But the bottom line is that your while loop is quite valid. HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Need help Win#2 Directory Walk and testing for file access
I need to move 3TB of data to a new SAN. I have to make sure that I have the correct tights to move the data so I want to test my data before the move. I want to walk the data and see if I have access to all the files. I am not sure how to test the files to see if I have access or not. I don't need to know what access I need to know if anyone took my group out. I can still stat a file but how can I test for write access without writing to a file. Here is what I have use File::DirWalk; my $dw = new File::DirWalk; $dw-onFile(sub { my ($file) = @_; if(length($file) 1) { print #!!!### -- Paused File = $file\n; $pause = STDIN; } print $file . \n; return File::DirWalk::SUCCESS; }); my($walkPath) = @ARGV; chomp($walkPath); $dw-walk($walkPath); I used a length comparison to see if files that I don't have access too returns a length. Any Ideas? Thanks -T
Re: Need help Win#2 Directory Walk and testing for file access
Gallagher, Tim F (NE) am Dienstag, 12. September 2006 20:39: I need to move 3TB of data to a new SAN. I have to make sure that I have the correct tights to move the data so I want to test my data before the move. I want to walk the data and see if I have access to all the files. I am not sure how to test the files to see if I have access or not. I don't need to know what access I need to know if anyone took my group out. I can still stat a file but how can I test for write access without writing to a file. Here is what I have use File::DirWalk; my $dw = new File::DirWalk; $dw-onFile(sub { my ($file) = @_; if(length($file) 1) I don't work on windows anymore, but what about if (-r $file) # is file readable? See perldoc -f -X (I don't quite understand why you should have to test for *write* access of files to copy ?!? If you have to: Try the -w test) { print #!!!### -- Paused File = $file\n; $pause = STDIN; } print $file . \n; return File::DirWalk::SUCCESS; }); my($walkPath) = @ARGV; chomp($walkPath); $dw-walk($walkPath); I used a length comparison to see if files that I don't have access too returns a length. Any Ideas? Hope this helps Dani -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
How to use Perl for API testing
Hi, I want to use PERL for API testing, i.e., I want to call different URLs through the browser. How much is possin The information contained in, or attached to, this e-mail, contains confidential information and is intended solely for the use of the individual or entity to whom they are addressed and is subject to legal privilege. If you have received this e-mail in error you should notify the sender immediately by reply e-mail, delete the message from your system and notify your system manager. Please do not copy it for any purpose, or disclose its contents to any other person. The views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of the company. The recipient should check this e-mail and any attachments for the presence of viruses. The company accepts no liability for any damage caused, directly or indirectly, by any virus transmitted in this email. www.aztecsoft.com
RE: How to use Perl for API testing
Have you took a look at CPAN?for example,LWP::UserAgent. I want to use PERL for API testing, i.e., I want to call different URLs through the browser. How much is possin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: How to use Perl for API testing
You might want to consider Test::WWW::Mechanize http://search.cpan.org/author/PETDANCE/Test-WWW- Mechanize-1.12/Mechanize.pm or WWW-Mechanize http://search.cpan.org/~petdance/WWW-Mechanize-1.18/ lib/WWW/Mechanize.pm -- MattJ On Jul 9, 2006, at 10:13 PM, Suja Emmanuel wrote: Hi, I want to use PERL for API testing, i.e., I want to call different URLs through the browser. How much is possin The information contained in, or attached to, this e-mail, contains confidential information and is intended solely for the use of the individual or entity to whom they are addressed and is subject to legal privilege. If you have received this e-mail in error you should notify the sender immediately by reply e-mail, delete the message from your system and notify your system manager. Please do not copy it for any purpose, or disclose its contents to any other person. The views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of the company. The recipient should check this e-mail and any attachments for the presence of viruses. The company accepts no liability for any damage caused, directly or indirectly, by any virus transmitted in this email. www.aztecsoft.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
How to use Perl for API testing
Hi, I want to use PERL for API testing, i.e., I want to call different URLs through the browser. I am new to Perl. Can you help me to write a script to call many URLs through browser. Thanks in advance, Suja Emmanuel. The information contained in, or attached to, this e-mail, contains confidential information and is intended solely for the use of the individual or entity to whom they are addressed and is subject to legal privilege. If you have received this e-mail in error you should notify the sender immediately by reply e-mail, delete the message from your system and notify your system manager. Please do not copy it for any purpose, or disclose its contents to any other person. The views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of the company. The recipient should check this e-mail and any attachments for the presence of viruses. The company accepts no liability for any damage caused, directly or indirectly, by any virus transmitted in this email. www.aztecsoft.com
RE: How to use Perl for API testing
Are you testing on IE? There is an Win32::IEAutomation module that should be able to handle what you want if IE is the browser you want to test. -Original Message- From: Suja Emmanuel [mailto:[EMAIL PROTECTED] Sent: Sunday, July 09, 2006 10:16 PM To: beginners@perl.org Subject: How to use Perl for API testing Hi, I want to use PERL for API testing, i.e., I want to call different URLs through the browser. I am new to Perl. Can you help me to write a script to call many URLs through browser. snip really long disclaimer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: How to use Perl for API testing
-Original Message- From: Suja Emmanuel [mailto:[EMAIL PROTECTED] Sent: Sunday, July 09, 2006 10:16 PM To: beginners@perl.org Subject: How to use Perl for API testing Hi, I want to use PERL for API testing, i.e., I want to call different URLs through the browser. I am new to Perl. Can you help me to write a script to call many URLs through browser. snip really long disclaimer In addition to what has been posted previously, there is also SAMIE. http://samie.sourceforge.net/ -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.9.10/383 - Release Date: 7/7/2006 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
testing perl
How can we test our Perl script? DISCLAIMER: This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.
Re: testing perl
On Mon, 9 Jan 2006, Saurabh_Agarwal wrote: How can we test our Perl script? At the command prompt run #perl -c script.pl If there are no errors, it compiles ok If there are errors, fix them then run #perl script.pl and see if your logig is correct HTH Owen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: testing perl
On Mon, 9 Jan 2006, Saurabh_Agarwal wrote: How can we test our Perl script? We can test our Perl script carefully. -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: testing perl
I want to know how to use perl -d -Original Message- From: Owen Cook [mailto:[EMAIL PROTECTED] Sent: Monday, January 09, 2006 10:51 AM To: Saurabh_Agarwal Cc: beginners@perl.org Subject: Re: testing perl On Mon, 9 Jan 2006, Saurabh_Agarwal wrote: How can we test our Perl script? At the command prompt run #perl -c script.pl If there are no errors, it compiles ok If there are errors, fix them then run #perl script.pl and see if your logig is correct HTH Owen DISCLAIMER: This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: testing perl
On Mon, 9 Jan 2006, Saurabh_Agarwal wrote: I want to know how to use perl -d perldoc perldebug -- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response