<meta http-equiv="content-type" content="text/html; charset=utf-8"><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">
<span style="color: rgb(31, 73, 125); ">Here is the code from the cgi with line numbers:</span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
<font class="Apple-style-span" color="#1F497D" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"> 39 use MyPackages::Local;</span></font></p><div style="border-collapse: collapse; color: rgb(31, 73, 125); font-family: arial, sans-serif; font-size: 13px; ">
...</div><p></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><span style="color: rgb(31, 73, 125); "> 1965 unless(<b>check_if_config_file_exists</b>('datafile.cfg')) {</span></p>
<p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><span style="color: rgb(31, 73, 125); "> 1966 print "The file does not exist. \n";</span></p>
<p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><span style="color: rgb(31, 73, 125); "> 1967 }</span></p>
<p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><span style="color: rgb(31, 73, 125); "> 1968 unless(<b>check_if_config_file_readable</b>('datafile.cfg ')) {</span></p>
<p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><span style="color: rgb(31, 73, 125); "> 1969 print "The file is unreadable.\n";</span></p>
<p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><span style="color: rgb(31, 73, 125); "> 1970 }</span></p>
<p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><span style="color: rgb(31, 73, 125); "> </span></p>
<p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><span style="color: rgb(31, 73, 125); ">The error message is always pointing to line 1968.</span></p>
<p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><span style="color: rgb(31, 73, 125); "> </span></p>
<p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><span style="color: rgb(31, 73, 125); ">Both of the <b>check_if_config_file_*</b> subroutines are defined in the same module included earlier in the CGI script, and are only used in this section.</span></p>
<p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><span style="color: rgb(31, 73, 125); "> </span></p>
<p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><span style="color: rgb(31, 73, 125); ">There are no undef commands going on.<b></b></span></p>
<p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><span style="color: rgb(31, 73, 125); "> </span></p>
<p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><span style="color: rgb(31, 73, 125); ">Here’s a few snippets of the MyPackages::Local file. (Don't laugh - I haven't maintained this module code, so there are a lot of Perl-Golf code refactoring I'd like to do...) [Some names have been changed to protect the innocent... :-) ]</span></p>
<p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><span style="color: rgb(31, 73, 125); ">=== begin ===</span></p>
<div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><span class="Apple-style-span" style="color: rgb(31, 73, 125); "> 3 package MyPackages::Local;</span></div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">
<span style="color: rgb(31, 73, 125); "><div>...</div><div> 14 use Exporter;</div></span></div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><span style="color: rgb(31, 73, 125); "><div>
15 @ISA = qw(Exporter);</div><div> 16 @EXPORT = qw(</div><div> 17 check_if_config_file_exists</div><div> 18 check_if_config_file_readable</div><div>...</div><div><div> 43 );</div></div><div>...</div><div>
<div>142 sub check_if_config_file_exists {</div><div>143 my ($target) = @_;</div><div>144 if (-e "$fl{$target}") {</div><div>145 return 1;</div><div>146 }</div><div>147 else {</div>
<div>148 return 0;</div><div>149 }</div><div>150 }</div><div>151 </div><div>152 sub check_if_config_file_readable {</div><div>153 my ($target) = @_;</div><div>154 if (-r "$fl{$target}") {</div>
<div>155 return 1;</div><div>156 }</div><div>157 else {</div><div>158 return 0;</div><div>159 }</div><div>160 </div><div>161 }</div></div><div>...</div><div><div>916 # Make use/require happy</div>
<div>917 #</div><div>918 1;</div></div><div><EOF></div><div>=== end ===</div><div><br></div><div>So, nothing much there that I can see, especially considering this exact same code on the same server will work fine for weeks, then give the "Undefined subroutine" error for a few minutes in a row, then continue to work.</div>
<div><br></div><div>I'll keep plugging and double check with the user who reported it.</div><div><br></div><div>Thanks,</div><div>Dan</div></span></div><br><div class="gmail_quote">2010/10/29 Sterling Hanenkamp <span dir="ltr"><<a href="mailto:sterling@hanenkamp.com">sterling@hanenkamp.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Do any of the subs do some sort of conditional import into main or muck with the symbol table?<div><br><div>For example:</div>
<div><br></div><div><div>use 5.12.1;</div><div>sub foo { say 'test' }</div><div><br></div>
<div>if (rand > 0.5) {</div><div> undef *{foo};</div><div>}</div><div><br></div><div>foo();</div><div><br></div><div>50% of the time will print "test" and the other 50% will print:</div><div><br></div><div>
Undefined subroutine &main::foo called at <a href="http://test.pl" target="_blank">test.pl</a> line 8.</div><div><div></div><div class="h5"><br><div class="gmail_quote">On Fri, Oct 29, 2010 at 11:47 AM, Jay Hannah <span dir="ltr"><<a href="mailto:jhannah@mutationgrid.com" target="_blank">jhannah@mutationgrid.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Oct 29, 2010, at 10:11 AM, Dan Linder wrote:<br>
> Status: 500 Content-type: text/html<br>
> Software error:<br>
> Undefined subroutine &main::MySubroutine called at MyCGI.cgi line 123<br>
><br>
</div><div>> I'm asking my server admin to send me the Apache log files (it's a remote server I don't have access to) - is there anything else to look at?<br>
<br>
</div>Is it vanilla CGI (perl is executed for every page hit)? mod_perl? fastcgi? other?<br>
<br>
I'd write a little WWW::Mechanize program to hit it 1000 times and see how many times the error occurs. If you think it's load related somehow (really? eek) then you could use Apache Benchmark (ab) to nail the heck out of it and see if load does indeed cause a problem.<br>
<br>
Do you have another server with the same software to compare results?<br>
<br>
HTH,<br>
<br>
Jay Hannah<br>
Software Architect<br>
<a href="mailto:jhannah@mutationgrid.com" target="_blank">jhannah@mutationgrid.com</a> | <a href="http://mutationgrid.com" target="_blank">http://mutationgrid.com</a> | 1-402-598-7782<br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
Omaha-pm mailing list<br>
<a href="mailto:Omaha-pm@pm.org" target="_blank">Omaha-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/omaha-pm" target="_blank">http://mail.pm.org/mailman/listinfo/omaha-pm</a><br>
</blockquote></div><br><br clear="all"><br></div></div>-- <br>Andrew Sterling Hanenkamp<br><a href="mailto:sterling@hanenkamp.com" target="_blank">sterling@hanenkamp.com</a><br>785.370.4454<br>
</div></div>
<br>_______________________________________________<br>
Omaha-pm mailing list<br>
<a href="mailto:Omaha-pm@pm.org">Omaha-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/omaha-pm" target="_blank">http://mail.pm.org/mailman/listinfo/omaha-pm</a><br></blockquote></div><br><br clear="all"><br>-- <br>***************** ************* *********** ******* ***** *** **<br>
"Quis custodiet ipsos custodes?"<br> (Who can watch the watchmen?)<br> -- from the Satires of Juvenal<br>"I do not fear computers, I fear the lack of them."<br> -- Isaac Asimov (Author)<br>** *** ***** ******* *********** ************* *****************<br>