On 12-03-27 10:16 AM, Anirban Adhikary wrote:
I have found the solution. I need to write a line to top of my code and its works. use Lib "Path to your perl code"; then I can run this perl code directly from crontab I dont need a shell script to call the perl code.
Try using FindBin. FindBin was written to solve problems like this and it doesn't require a hard-coded path; you can move your script around and it still works.
use FindBin qw( $RealBin ); use lib $RealBin; # application's `use module;` go here -- Just my 0.00000002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. [edited for today's programmers] "Show me your code and conceal your interfaces, and I shall continue to be mystified. Show me your interfaces, and I won't usually need your code; it'll be obvious." -- Fred Brooks "If you want to make something that's dirt cheap, make it out of dirt." -- Donald Sadoway -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/