Strange Error
Hello, I'm getting a strange error and for the life of me can't figure out what causing it. All that's in the error log is the following: [Mon Apr 19 13:01:37 2010] index.cgi: Invalid offset: 1 Would anyone have any ideas what to look for that would cause this type of error message ? Thanks, Mike(mickalo)Blezien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thunder Rain Internet Publishing -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Re: Strange Error
On 4/19/10 Mon Apr 19, 2010 11:07 AM, Mike Blezien mick...@frontiernet.net scribbled: Hello, I'm getting a strange error and for the life of me can't figure out what causing it. All that's in the error log is the following: [Mon Apr 19 13:01:37 2010] index.cgi: Invalid offset: 1 Would anyone have any ideas what to look for that would cause this type of error message ? It could be an explicit test in the program that is running. It looks like you are running a CGI program. Is it written in Perl? Do you have access to the source code? If so, find the source code (index.cgi?) and search for the string 'Invalid offset:' and look at the code just before it. That string does not turn up in 'perldoc perldiag', so might be issued by the program explicitly, or maybe a module used by the program. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Strange Error
Hi Jim, After futher digging we found the problem it had to do with a DateTime string. Thanks for the help. Mike(mickalo)Blezien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thunder Rain Internet Publishing -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - Original Message - From: Jim Gibson jimsgib...@gmail.com To: Perl List beginners@perl.org Sent: Monday, April 19, 2010 4:14 PM Subject: Re: Strange Error On 4/19/10 Mon Apr 19, 2010 11:07 AM, Mike Blezien mick...@frontiernet.net scribbled: Hello, I'm getting a strange error and for the life of me can't figure out what causing it. All that's in the error log is the following: [Mon Apr 19 13:01:37 2010] index.cgi: Invalid offset: 1 Would anyone have any ideas what to look for that would cause this type of error message ? It could be an explicit test in the program that is running. It looks like you are running a CGI program. Is it written in Perl? Do you have access to the source code? If so, find the source code (index.cgi?) and search for the string 'Invalid offset:' and look at the code just before it. That string does not turn up in 'perldoc perldiag', so might be issued by the program explicitly, or maybe a module used by the program. -- 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: problem runing code | strange Error
Juan B wrote: Ok I did it and know I get another error :-( here goes the error: Died at /usr/lib/perl5/site_perl/5.8.8/Mail/Mailer.pm line 284. I don't have that module and therefore have no idea what line 284 is or to what it applies, but here are a couple suggestions. this is the code: use strict; use warnings; use Mail::Mailer; my @lines = (); open (INFO, /var/log/messages) or die $!; while (my $line = INFO) { if ($line =~ /IDS/) { push @lines,$line; } } close INFO; if (@lines) { my $mailer = Mail::Mailer-new(smtp, 10.83.27.71); You may not want to call the constructor directly and rather let the underlying system handle it with a my $mailer = new Mail::Mailer(...) $mailer-open({ 'From' = 'Syslog [EMAIL PROTECTED]', 'To' = 'gabriela pinado [EMAIL PROTECTED]', 'Subject' = 'PiX Detected Attack' }); print $mailer @lines; You're treating this array as a scalar...you're likely to get an e-mail which contains nothing but an integer. $mailer-close or die can't close mailer: $!; } ~ please assist! thanks very much ! Juan __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
problem runing code | strange Error
-Hi, Im trying to run this code: (im getting this error message): Can't use string (From) as a HASH ref while strict refs in use at /usr/lib/perl5/site_perl/5.8.8/Mail/Mailer.pm line 320. The code: use strict; use warnings; use Mail::Mailer; my @lines = (); open (INFO, /var/log/messages) or die $!; while (my $line = INFO) { if ($line =~ /IDS/) { push @lines,$line; } } close INFO; if (@lines) { my $mailer = Mail::Mailer-new(smtp, 10.83.27.71); $mailer-open( 'From' = 'Syslog [EMAIL PROTECTED]', 'To' = 'gabriela pinado [EMAIL PROTECTED]', 'Subject' = 'PiX Detected Attack ' ); print $mailer @lines; $mailer-close or die can't close mailer: $!; } Any ideas where is the problem? thanks a lot ! Juan __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: problem runing code | strange Error
On Oct 23, 9:57 am, [EMAIL PROTECTED] (Juan B) wrote: -Hi, Im trying to run this code: (im getting this error message): Can't use string (From) as a HASH ref while strict refs in use at /usr/lib/perl5/site_perl/5.8.8/Mail/Mailer.pm line 320. The code: use strict; use warnings; use Mail::Mailer; my @lines = (); open (INFO, /var/log/messages) or die $!; while (my $line = INFO) { if ($line =~ /IDS/) { push @lines,$line; }} close INFO; if (@lines) { my $mailer = Mail::Mailer-new(smtp, 10.83.27.71); $mailer-open( 'From' = 'Syslog [EMAIL PROTECTED]', 'To' = 'gabriela pinado [EMAIL PROTECTED]', 'Subject' = 'PiX Detected Attack ' ); Mail::Mailer::open takes a hash reference. You have passed it a list of key/value pairs. Stick a { before 'From' and a } after 'Attack' to create your hash reference. Paul Lalli -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: problem runing code | strange Error
Hi, I did it and know I get another error: syntax error at logcheck line 25, near 'PiX Detected Attack } ' ) Missing right curly or square bracket at logcheck line 28, at end of line Execution of logcheck aborted due to compilation errors. This is the code: use strict; use warnings; use Mail::Mailer; my @lines = (); open (INFO, /var/log/messages) or die $!; while (my $line = INFO) { if ($line =~ /IDS/) { push @lines,$line; } } close INFO; if (@lines) { my $mailer = Mail::Mailer-new(smtp, 10.83.27.71); $mailer-open( {'From' = 'Syslog [EMAIL PROTECTED]', 'To' = 'gabriela pinado [EMAIL PROTECTED]', 'Subject' = 'PiX Detected Attack } ' ); print $mailer @lines; $mailer-close or die can't close mailer: $!; thanks a lot ! Juan __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: problem runing code | strange Error
From: Juan B [EMAIL PROTECTED] use Mail::Mailer; snipped my $mailer = Mail::Mailer-new(smtp, 10.83.27.71); $mailer-open( 'From' = 'Syslog [EMAIL PROTECTED]', 'To' = 'gabriela pinado [EMAIL PROTECTED]', 'Subject' = 'PiX Detected Attack ' ); The open() expects a single parameter, a reference to a hash. Not a list of parameters, the odd ones being names and the even ones the values. Use $mailer-open({ 'From' = 'Syslog [EMAIL PROTECTED]', 'To' = 'gabriela pinado [EMAIL PROTECTED]', 'Subject' = 'PiX Detected Attack' }); HTH, 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: problem runing code | strange Error
Ok I did it and know I get another error :-( here goes the error: Died at /usr/lib/perl5/site_perl/5.8.8/Mail/Mailer.pm line 284. this is the code: use strict; use warnings; use Mail::Mailer; my @lines = (); open (INFO, /var/log/messages) or die $!; while (my $line = INFO) { if ($line =~ /IDS/) { push @lines,$line; } } close INFO; if (@lines) { my $mailer = Mail::Mailer-new(smtp, 10.83.27.71); $mailer-open({ 'From' = 'Syslog [EMAIL PROTECTED]', 'To' = 'gabriela pinado [EMAIL PROTECTED]', 'Subject' = 'PiX Detected Attack' }); print $mailer @lines; $mailer-close or die can't close mailer: $!; } ~ please assist! thanks very much ! Juan __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: problem runing code | strange Error
From: Juan B [EMAIL PROTECTED] Ok I did it and know I get another error :-( here goes the error: Died at /usr/lib/perl5/site_perl/5.8.8/Mail/Mailer.pm line 284. That's not a very informative error message. anyway maybe it's time to go read the Mail::Mailer's docs. Search for smtp and look at the example. this is the code: use strict; use warnings; use Mail::Mailer; my @lines = (); open (INFO, /var/log/messages) or die $!; while (my $line = INFO) { if ($line =~ /IDS/) { push @lines,$line; } } close INFO; if (@lines) { my $mailer = Mail::Mailer-new(smtp, 10.83.27.71); 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/
problem runing code | strange Error
Hi, Im trying to run this code: (im getting this error message): Can't use string (From) as a HASH ref while strict refs in use at / usr/lib/perl5/site_perl/5.8.8/Mail/Mailer.pm line 320. The code: use strict; use warnings; use Mail::Mailer; my @lines = (); open (INFO, /var/log/messages) or die $!; while (my $line = INFO) { if ($line =~ /IDS/) { push @lines,$line; } } close INFO; if (@lines) { my $mailer = Mail::Mailer-new(smtp, 10.83.27.71); $mailer-open( 'From' = 'Syslog [EMAIL PROTECTED]', 'To' = 'gabriela pinado [EMAIL PROTECTED]', 'Subject' = 'PiX Detected Attack ' ); print $mailer @lines; $mailer-close or die can't close mailer: $!; } Any ideas where is the problem? thanks a lot ! Juan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: problem runing code | strange Error
[EMAIL PROTECTED] wrote: Im trying to run this code: (im getting this error message): Can't use string (From) as a HASH ref while strict refs in use at / usr/lib/perl5/site_perl/5.8.8/Mail/Mailer.pm line 320. The code: use strict; use warnings; use Mail::Mailer; my @lines = (); open (INFO, /var/log/messages) or die $!; while (my $line = INFO) { if ($line =~ /IDS/) { push @lines,$line; } } close INFO; if (@lines) { my $mailer = Mail::Mailer-new(smtp, 10.83.27.71); $mailer-open( 'From' = 'Syslog [EMAIL PROTECTED]', 'To' = 'gabriela pinado [EMAIL PROTECTED]', 'Subject' = 'PiX Detected Attack ' ); print $mailer @lines; $mailer-close or die can't close mailer: $!; } Any ideas where is the problem? Yes. As stated in the docs for Mail::Mailer, the open() method expects a hash reference as its argument. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Strange error
On Sep 24, 9:17 pm, [EMAIL PROTECTED] (Caronte) wrote: Hi everybody. I'm learning Perl and CGI programming using MAMP as web- server on OSX and I can't use the standard CGI module. Look at this (very) simple script: #!/usr/local/bin/perl First obvious question, is that the correct path? [Mon Sep 24 21:00:38 2007] [error] [client ::1] (2)No such file or directory: exec of '/Applications/MAMP/cgi-bin/backatcha-cgi' failed Second obvious question, is that the correct path? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Strange error
On 25 Set, 12:37, [EMAIL PROTECTED] (Matthew Whipple) wrote: Some suggestions: rewrite ':standard'; as qw/:standard/; use warnings; check the web server error log for more verbose debugging information It would be a lot easier to diagnose if you know what file or directory isn't being found/accessed. Caronte wrote: Hi everybody. I'm learning Perl and CGI programming using MAMP as web- server on OSX and I can't use the standard CGI module. Look at this (very) simple script: #!/usr/local/bin/perl use CGI ':standard'; print header(); print start_html(); for $i (param()) { print b, $i, /b: , param($i), br\n; } print end_html(); It should shows a blank page; on the contrary it outputs the following error: 500 Server Error [Mon Sep 24 21:00:38 2007] [error] [client ::1] (2)No such file or directory: exec of '/Applications/MAMP/cgi-bin/backatcha-cgi' failed [Mon Sep 24 21:00:38 2007] [error] [client ::1] Premature end of script headers: backatcha-cgi It works from the command line, anyway. Scripts without cgi modules works instead. Thanks for any help False alarm. The problem was the intepreter directory; I fixed it replacing the first line with #!/usr/bin/perl...I'm a little ashamed :-). Ken, Matthew thank you for your answers. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Strange error
Hi everybody. I'm learning Perl and CGI programming using MAMP as web- server on OSX and I can't use the standard CGI module. Look at this (very) simple script: #!/usr/local/bin/perl use CGI ':standard'; print header(); print start_html(); for $i (param()) { print b, $i, /b: , param($i), br\n; } print end_html(); It should shows a blank page; on the contrary it outputs the following error: 500 Server Error [Mon Sep 24 21:00:38 2007] [error] [client ::1] (2)No such file or directory: exec of '/Applications/MAMP/cgi-bin/backatcha-cgi' failed [Mon Sep 24 21:00:38 2007] [error] [client ::1] Premature end of script headers: backatcha-cgi It works from the command line, anyway. Scripts without cgi modules works instead. Thanks for any help -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Strange error
500 Server Error [Mon Sep 24 21:00:38 2007] [error] [client ::1] (2)No such file or directory: exec of '/Applications/MAMP/cgi-bin/backatcha-cgi' failed [Mon Sep 24 21:00:38 2007] [error] [client ::1] Premature end of script headers: backatcha-cgi Why is there a hyphen not a dot? backatcha.cgi -- Ken Foskey FOSS developer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Strange error
Some suggestions: rewrite ':standard'; as qw/:standard/; use warnings; check the web server error log for more verbose debugging information It would be a lot easier to diagnose if you know what file or directory isn't being found/accessed. Caronte wrote: Hi everybody. I'm learning Perl and CGI programming using MAMP as web- server on OSX and I can't use the standard CGI module. Look at this (very) simple script: #!/usr/local/bin/perl use CGI ':standard'; print header(); print start_html(); for $i (param()) { print b, $i, /b: , param($i), br\n; } print end_html(); It should shows a blank page; on the contrary it outputs the following error: 500 Server Error [Mon Sep 24 21:00:38 2007] [error] [client ::1] (2)No such file or directory: exec of '/Applications/MAMP/cgi-bin/backatcha-cgi' failed [Mon Sep 24 21:00:38 2007] [error] [client ::1] Premature end of script headers: backatcha-cgi It works from the command line, anyway. Scripts without cgi modules works instead. Thanks for any help -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Strange error: PerlRun
too few info u have given. It seems that u have problem at the interface of cgi script to web server. 2005/9/28, Graeme McLaren [EMAIL PROTECTED]: Afternoon all, I have a strange error: [Tue Sep 27 14:43:41 2005] [error] PerlRun: `failed at stage 1: Input/output error at /usr/local/lib/perl5/5.8.0/CGI/Carp.pm line 301. I have had a google around and I've not found anything. Does anyone know what this means or what problem this could point to? Cheers in advance, Graeme :) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- Jeff Peng [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Strange Error
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Mike Blezien) writes: Gunnar Hjalmarsson wrote: Mike Blezien wrote: What does this type of error indicate, I never encountered this type of error before. Modification of a read-only value attempted at /home/www/cgi/somescript.cgi line 151. code snip my($sparam); foreach $sparam (param()) { ${$sparam} = param($sparam); } # line 151 Maybe it's that; hard to tell since you don't give more context. But what you are trying to do, i.e. using symbolic references, is unnecessary and considered bad programming practice. [snip] Thanks for the suggestion. We've used this type of coding scheme before with no problems in the past, but wasn't aware it was considered bad programming practice. Since it caused you an error you didn't understand, you now know one of the reasons why :-) Consider what that line would do if you had a parameter with the name 1 (digit one). You should *always* use strict in your code. -- Peter Scott http://www.perldebugged.com/ *** NEW *** http://www.perlmedic.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Strange Error
Gunnar Hjalmarsson wrote: Mike Blezien wrote: What does this type of error indicate, I never encountered this type of error before. - Modification of a read-only value attempted at /home/www/cgi/somescript.cgi line 151. - code snip my($sparam); foreach $sparam (param()) { ${$sparam} = param($sparam); } # line 151 -- Maybe it's that; hard to tell since you don't give more context. But what you are trying to do, i.e. using symbolic references, is unnecessary and considered bad programming practice. The standard way to avoid it is to use a hash instead of a bunch of scalars. In the case of CGI parameters, you can simply do e.g.: use CGI; my %param = new CGI-Vars; That would give you all the parameters conveniently available in the %param hash. Thanks for the suggestion. We've used this type of coding scheme before with no problems in the past, but wasn't aware it was considered bad programming practice. Regards, -- Mike(mickalo)Blezien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thunder Rain Internet Publishing Providing Internet Solutions that work! http://thunder-rain.com/ Tel: 1.712.395.0670 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Strange Error
Mike Blezien wrote: Gunnar Hjalmarsson wrote: Mike Blezien wrote: foreach $sparam (param()) { ${$sparam} = param($sparam); } # line 151 - Maybe it's that; hard to tell since you don't give more context. But what you are trying to do, i.e. using symbolic references, is unnecessary and considered bad programming practice. The standard way to avoid it is to use a hash instead of a bunch of scalars. In the case of CGI parameters, you can simply do e.g.: use CGI; my %param = new CGI-Vars; That would give you all the parameters conveniently available in the %param hash. Thanks for the suggestion. We've used this type of coding scheme before with no problems in the past, but wasn't aware it was considered bad programming practice. It's explained in the Perl FAQ: perldoc -q variable name Sorry for not providing that reference in the first place. ;-) -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Strange Error
Hello, What does this type of error indicate, I never encountered this type of error before. - Modification of a read-only value attempted at /home/www/cgi/somescript.cgi line 151. - code snip my($sparam); foreach $sparam (param()) { ${$sparam} = param($sparam); } # line 151 TIA, -- Mike(mickalo)Blezien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thunder Rain Internet Publishing Providing Internet Solutions that work! http://thunder-rain.com/ Tel: 1.712.395.0670 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Strange Error
Mike Blezien wrote: What does this type of error indicate, I never encountered this type of error before. - Modification of a read-only value attempted at /home/www/cgi/somescript.cgi line 151. - code snip my($sparam); foreach $sparam (param()) { ${$sparam} = param($sparam); } # line 151 -- Maybe it's that; hard to tell since you don't give more context. But what you are trying to do, i.e. using symbolic references, is unnecessary and considered bad programming practice. The standard way to avoid it is to use a hash instead of a bunch of scalars. In the case of CGI parameters, you can simply do e.g.: use CGI; my %param = new CGI-Vars; That would give you all the parameters conveniently available in the %param hash. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Strange error
Dharmendra rai wrote: Hi Hello, Read Perl regular expressions. Thanks for the advice. Why do you feel that I need to read Perl regular expressions and what is it and where can I find it? John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strange error
man perlregxp __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strange error
On Fri, 6 Sep 2002, Dharmendra Rai wrote: man perlregxp Have you tried this out? I had mentioned to you a few days earlier to not remove relevant parts of the post when replying. You continue in this fashion, people in this list will not know what you are replying too and this can only lead to confusion. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strange error
Dharmendra rai wrote: man perlregxp $ man perlregxp No manual entry for perlregxp John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strange error
go to www.perldoc.com/perl5.8.0/pod/perl.html and read perlre __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strange error
well perlregxp( perl regular experssion which i wrote clearly) stands for 'perlre. __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strange error
Dharmendra rai wrote: go to www.perldoc.com/perl5.8.0/pod/perl.html and read perlre Why, when /usr/lib/perl5/5.6.0/pod/perlre.pod and /usr/share/man/man1/perlre.1 are on my hard drive? John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strange error
Then there is no problem :) Thanx __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Strange error
All, I am experiencing the most bizarre problem with my perl script. I am running the below script on windows nt, that may be the root of the problem.. The script reads a file and checks to see it the words Sleeping for 10 seconds appears. If it appears four times in a row it sends a text message so, we can correct the problem. What seems to happen is after the script runs for about 2 months with out restarting the box, at some point it starts reading Sleeping for 1The other thing I notice is when this occurs the output of looks different. For example: When it is working it looks like this Sleeping for 10 seconds Sleeping for 10 seconds Sleeping for 10 seconds Sleeping for 10 seconds Send email When it is not working it looks like this: Sleeping for 1 Sleeping for 1 Sleeping for 1 Sleeping for 1 END As you notice there is a tb added to the script.. Anyone have an Idea to why this occurring. Below you will see the script Thank you in advance for you help Lance #!/usr/bin/perl my $count = 0; open MAIL_LOG, siebel_mail.log or die can't append to siebl_mail.log: $!; # do this 7 times for (1 .. 7) { open OUTPUT, '..\\..\\srvrmgr /ser server.com /e CHK_ENT_PRD /s CHK_SBL_PRD /u xx /p xxx /c list tasks for server CHK_SBL_PRD component Email Manager |' or die can't run srvrmgr: $!; OUTPUT for 1 .. 22; # skip first 22 lines of output my $line = substr OUTPUT, 106, 22; close OUTPUT; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); if ($count eq 4) { use Mail::Sendmail;#Send and email if there are errors %mail = ( To = '[EMAIL PROTECTED]', From= '[EMAIL PROTECTED]', Subject = '', Message = 'Email Manager hung on Apollo' ); sendmail(%mail) or die $Mail::Sendmail::error; print OK. Log says:\n, $Mail::Sendmail::log; print Apollo is stuck sent Email\n; if ($hour 12) { print MAIL_LOG Error Sending Email,$hour-12,:$min\n; } else { print MAIL_LOG Error Sending Email$hour:$min\n; } print MAIL_LOG --- \n; close MAIL_LOG; exit; } else { if ($line eq Sleeping for 10 second) { $count++; print Count $count\n; print MAIL_LOG $line, \n; } else { print $line, \n; print Count $count\n; print MAIL_LOG $line, \n; } sleep 10; } } if ($hour 12) { print MAIL_LOG Completed,$hour-12,:$min\n; } else { print MAIL_LOG Completed$hour:$min\n; } print MAIL_LOG --- \n; close MAIL_LOG; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Strange error
Let me ask this then. If I wanted to work around the fluctuations, could I just search for a string in the doc rather the going to a position and only looking there? If so does anyone know of documentation on the web that would help me with this? Thanks Lance -Original Message- From: John W. Krahn [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 4:04 PM To: [EMAIL PROTECTED] Subject: Re: Strange error Lance Prais wrote: I am experiencing the most bizarre problem with my perl script. I am running the below script on windows nt, that may be the root of the problem.. The script reads a file and checks to see it the words Sleeping for 10 seconds appears. If it appears four times in a row it sends a text message so, we can correct the problem. What seems to happen is after the script runs for about 2 months with out restarting the box, at some point it starts reading Sleeping for 1 The other thing I notice is when this occurs the output of looks different. For example: When it is working it looks like this Sleeping for 10 seconds Sleeping for 10 seconds Sleeping for 10 seconds Sleeping for 10 seconds Send email When it is not working it looks like this: Sleeping for 1 Sleeping for 1 Sleeping for 1 Sleeping for 1 END As you notice there is a tb added to the script.. Anyone have an Idea to why this occurring. It could be because you are assuming that the string you are looking for is always at the same position in the string. Below you will see the script Thank you in advance for you help Lance #!/usr/bin/perl #!/usr/bin/perl -w use strict; my $count = 0; open MAIL_LOG, siebel_mail.log or die can't append to siebl_mail.log: $!; # do this 7 times for (1 .. 7) { open OUTPUT, '..\\..\\srvrmgr /ser server.com /e CHK_ENT_PRD /s CHK_SBL_PRD /u xx /p xxx /c list tasks for server CHK_SBL_PRD component Email Manager |' or die can't run srvrmgr: $!; OUTPUT for 1 .. 22; # skip first 22 lines of output my $line = substr OUTPUT, 106, 22; ^^^ Is the string always at this position? close OUTPUT; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); if ($count eq 4) ^^ You should use a numerical operator to compare numbers. { use Mail::Sendmail;#Send and email if there are errors %mail = ( To = '[EMAIL PROTECTED]', From= '[EMAIL PROTECTED]', Subject = '', Message = 'Email Manager hung on Apollo' ); sendmail(%mail) or die $Mail::Sendmail::error; print OK. Log says:\n, $Mail::Sendmail::log; print Apollo is stuck sent Email\n; if ($hour 12) { print MAIL_LOG Error Sending Email ,$hour-12,:$min\n; } else { print MAIL_LOG Error Sending Email$hour:$min\n; } print MAIL_LOG --- \n; close MAIL_LOG; exit; } else { if ($line eq Sleeping for 10 second) { $count++; print Count $count\n; print MAIL_LOG $line, \n; } else { print $line, \n; print Count $count\n; print MAIL_LOG $line, \n; } sleep 10; } } if ($hour 12) { print MAIL_LOG Completed,$hour-12,:$min\n; } else { print MAIL_LOG Completed$hour:$min\n; } print MAIL_LOG --- \n; close MAIL_LOG; This should work better: #!/usr/bin/perl -w use strict; # the string to search for my $search = 'Sleeping for 10 seconds'; my $count = 0; my( $min, $hour ); open MAIL_LOG, siebel_mail.log or die can't append to siebl_mail.log: $!; # do this 7 times for ( 1 .. 7 ) { open OUTPUT, '..\\..\\srvrmgr /ser server.com /e CHK_ENT_PRD /s CHK_SBL_PRD /u xx /p xxx /c list tasks for server CHK_SBL_PRD component Email Manager |' or die can't run srvrmgr: $!; OUTPUT for 1 .. 22; # skip first 22 lines of output # set $found to true or false my $found = OUTPUT =~ /$search/; close OUTPUT; ( $min, $hour ) = (localtime)[1,2]; $hour -= 12 if $hour 12; if ( $count == 4 ) { use Mail::Sendmail; # Send and email if there are errors %mail = ( To = '[EMAIL PROTECTED]', From= '[EMAIL PROTECTED]', Subject
strange error message on exiting script
I am receiving a strange error on exiting a script: Attempt to free unreferenced scalar during global destruction. It only occurs after I make a DBI connection and run an SQL statement. I am undefing the statement handle and disconnecting the database handle. Does anyone have a clue what this might be? -- Today is Boomtime the 4th day of Discord in the YOLD 3168 Or is it? Missile Address: 33:48:3.521N 84:23:34.786W -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: strange error message on exiting script
I am receiving a strange error on exiting a script: Attempt to free unreferenced scalar during global destruction. It only occurs after I make a DBI connection and run an SQL statement. I am undefing the statement handle and disconnecting the database handle. use DBI; Does anyone have a clue what this might be? Make sure the statement or database handles don't go out of scope. Otherwise email me the complete code and I *should* be able to find the problem fairly quickly. Jonathan Paton __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: strange error message on exiting script
On Mon, 2002-03-18 at 13:05, Jonathan E. Paton wrote: I am receiving a strange error on exiting a script: Attempt to free unreferenced scalar during global destruction. It only occurs after I make a DBI connection and run an SQL statement. I am undefing the statement handle and disconnecting the database handle. use DBI; yes, I am using DBI. That is not the problem. Does anyone have a clue what this might be? Make sure the statement or database handles don't go out of scope. This is at the end of the script, as in exit(0); everything is going out of scope. I am not experiencing any problems in my code. I just get this error at the end. Otherwise email me the complete code and I *should* be able to find the problem fairly quickly. If you want the code I can send it to you, but there are still hard coded paths and it is Informix specific. I plan on making it generic, but right now I am sticking with what I know (ie $sth-{ix_NativeTypeName} instead of $sth-{TYPE}). Jonathan Paton __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Today is Boomtime the 4th day of Discord in the YOLD 3168 Keep the Lasagna flying! Missile Address: 33:48:3.521N 84:23:34.786W -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: strange error message on exiting script
Chas Owens wrote: I am receiving a strange error on exiting a script: Attempt to free unreferenced scalar during global destruction. It only occurs after I make a DBI connection and run an SQL statement. I am undefing the statement handle and disconnecting the database handle. Does anyone have a clue what this might be? perldoc perldiag [snip] Attempt to free unreferenced scalar (W internal) Perl went to decrement the reference count of a scalar to see if it would go to 0, and dis covered that it had already gone to 0 earlier, and should have been freed, and in fact, probably was freed. This could indicate that SvREFCNT_dec() was called too many times, or that SvREFCNT_inc() was called too few times, or that the SV was mortalized when it shouldn't have been, or that memory has been corrupted. Are you doing undef $scalar in your code? If so, don't. You should _never_ have to use undef in this manner. Use my() to create a lexical scope and let perl take care it. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: strange error message on exiting script
On Mon, 2002-03-18 at 14:21, John W. Krahn wrote: Chas Owens wrote: I am receiving a strange error on exiting a script: Attempt to free unreferenced scalar during global destruction. It only occurs after I make a DBI connection and run an SQL statement. I am undefing the statement handle and disconnecting the database handle. Does anyone have a clue what this might be? perldoc perldiag [snip] Attempt to free unreferenced scalar (W internal) Perl went to decrement the reference count of a scalar to see if it would go to 0, and dis covered that it had already gone to 0 earlier, and should have been freed, and in fact, probably was freed. This could indicate that SvREFCNT_dec() was called too many times, or that SvREFCNT_inc() was called too few times, or that the SV was mortalized when it shouldn't have been, or that memory has been corrupted. Are you doing undef $scalar in your code? If so, don't. You should _never_ have to use undef in this manner. Use my() to create a lexical scope and let perl take care it. John -- use Perl; program fulfillment I grepped the source code for undef and only got back these lines. app.pm: $sth = undef; app.pm: $sth = undef; app.pm: local($/) = undef; app.pm: return undef; app.pm: return undef; app.pm: return undef; app.pm: $row = undef; app.pm: return undef; It doesn't look like I am undefing a variable, only assigning undef to them (to free the cursor in two cases, to indicate no error in four cases, and to remove the contents of the variable in one case); however, there are some cases where I say things like: Gnome::MessageBox-new( 'A query is already running', 'warning', 'close' )-show_all; without catching the the object created by Gnome::MessageBox-new. Could these be the culprit? -- Today is Boomtime the 4th day of Discord in the YOLD 3168 Or is it? Missile Address: 33:48:3.521N 84:23:34.786W -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: strange error message on exiting script
I am undefing the statement handle and disconnecting the database handle. Does anyone have a clue what this might be? perldoc perldiag [snip] Attempt to free unreferenced scalar (W internal) Perl went to decrement the reference count of a scalar to see if it would go to 0, and discovered that it had already gone to 0 earlier, and should have been freed, and in fact, probably was freed. This could indicate that SvREFCNT_dec() was called too many times, or that SvREFCNT_inc() was called too few times, or that the SV was mortalized when it shouldn't have been, or that memory has been corrupted. Are you doing undef $scalar in your code? If so, don't. You should _never_ have to use undef in this manner. Use my() to create a lexical scope and let perl take care it. Sounds like John has been doing his homework so you don't need to! :) A quick skim over the DBI documention suggests you only need to disconnect the database, not destroy the statement handle. I don't remember destroying mine in my own code. Is that the problem solved then? Jonathan Paton __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: strange error message on exiting script
I grepped the source code for undef and only got back these lines. app.pm: $sth = undef; app.pm: $sth = undef; app.pm: local($/) = undef; app.pm: return undef; app.pm: return undef; app.pm: return undef; app.pm: $row = undef; app.pm: return undef; Try changing those: $sth = undef to: $sth-finish(); Jonathan Paton __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: strange error message on exiting script
On Mon, 2002-03-18 at 14:41, Jonathan E. Paton wrote: I grepped the source code for undef and only got back these lines. app.pm: $sth = undef; app.pm: $sth = undef; app.pm: local($/) = undef; app.pm: return undef; app.pm: return undef; app.pm: return undef; app.pm: $row = undef; app.pm: return undef; Try changing those: $sth = undef to: $sth-finish(); Jonathan Paton snip href=preldoc DBD::Informix Using $sth-finish simply closes the cursor but does not free the cursor or the statement. That is done when you destroy (undef) the statement handle: undef $sth; /snip; The program may run many SQL statements and I do not wish to be holding any extra resources on the DB Server. I believe I have found where the trigger condition for the error. It has nothing to do with the DBI code, I only get the error when I close one of the tabs in the notebook. I must be destroying it incorrectly. -- Today is Boomtime the 4th day of Discord in the YOLD 3168 Missile Address: 33:48:3.521N 84:23:34.786W -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re[2]: strange error message on exiting script
Monday, March 18, 2002, 7:21:51 PM, John W. Krahn wrote: perldoc perldiag [snip] Attempt to free unreferenced scalar (W internal) Perl went to decrement the reference count of a scalar to see if it would go to 0, and dis covered that it had already gone to 0 earlier, and should have been freed, and in fact, probably was freed. This could indicate that SvREFCNT_dec() was called too many times, or that SvREFCNT_inc() was called too few times, or that the SV was mortalized when it shouldn't have been, or that memory has been corrupted. Just for anyone who'd like to see informative stuff like that for all their warnings, adding use diagnostics; to the top of your script will give you the right section from perldiag at the same time your warning is generated. It also does a couple of other nifty bits like giving you a stack trace on die. Can be very helpful when trying to work out what's wrong with some code. -- Best Regards, Daniel [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: strange error message on exiting script
I am receiving a strange error on exiting a script: Attempt to free unreferenced scalar during global destruction. It only occurs after I make a DBI connection and run an SQL statement. I am undefing the statement handle and disconnecting the database handle. Does anyone have a clue what this might be? My guess is that because you're undef-ing $sth instead of just doing $sth-finish(), the destructor for whatever package $sth belongs to is getting mad when the object it's trying to clean up isn't there. I'm pretty sure this has been suggested already, but why can't you let $sth go out of scope (or force it to)? -dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]