Hi, long time listener, first time caller so to speak. Thanks to everyone who has answered other questions that I've found and used.
I'm self-taught in Perl and have been hacking at it for more than five years now, so your patience with me is appreciated.
Here's my issue. I have a Perl script (say, myscript.cgi) that is set to run on a cron job. It has a require line to another function library. (This is a procedural program, not OO):
require "mylib.pl";
The library is in the same directory as the script. When i call the script using a browser, it renders fine in the browser. i.e.,
http://myserver.com/cgi-bin/myscript.cgi
When I set the same myscript.cgi to run as a cron job, I get an error that one of the functions in mylib.pl can't be found:
Undefined subroutine &main::my_s ubroutine called at /home/my_username/public_html/mysite/cgi-bin/myscript.cgi line 77, <FHANDLE& gt; line 6.
Here's the rub: there are several calls in myscript to functions located in mylib. It is only functions that are added to the library recently that cause this failure. In other words, if the code hasn't changed in a while, it runs fine, regardless of where the procedure is located. But if I create a new procedure in mylib.pl, the cron version won't run it.
I am no expert on perl compilation, but if I am guessing that the problem is the cron job sees some cached version of my script somewhere and runs that one, failing to recompile and see my new function.
Does anyone know if my hunch is right? If so, how do I force it to recompile? Or am I totally off track?
Thanks in advance, it is very much appreciated.
I'm self-taught in Perl and have been hacking at it for more than five years now, so your patience with me is appreciated.
Here's my issue. I have a Perl script (say, myscript.cgi) that is set to run on a cron job. It has a require line to another function library. (This is a procedural program, not OO):
require "mylib.pl";
The library is in the same directory as the script. When i call the script using a browser, it renders fine in the browser. i.e.,
http://myserver.com/cgi-bin/myscript.cgi
When I set the same myscript.cgi to run as a cron job, I get an error that one of the functions in mylib.pl can't be found:
Undefined subroutine &main::my_s ubroutine called at /home/my_username/public_html/mysite/cgi-bin/myscript.cgi line 77, <FHANDLE& gt; line 6.
Here's the rub: there are several calls in myscript to functions located in mylib. It is only functions that are added to the library recently that cause this failure. In other words, if the code hasn't changed in a while, it runs fine, regardless of where the procedure is located. But if I create a new procedure in mylib.pl, the cron version won't run it.
I am no expert on perl compilation, but if I am guessing that the problem is the cron job sees some cached version of my script somewhere and runs that one, failing to recompile and see my new function.
Does anyone know if my hunch is right? If so, how do I force it to recompile? Or am I totally off track?
Thanks in advance, it is very much appreciated.
Comment