Hello Jim, On Wed, 15 Feb 2012 10:28:23 -0800 Jim Gibson <[email protected]> wrote:
> On 2/15/12 Wed Feb 15, 2012 10:13 AM, "Punit Jain" > <[email protected]> scribbled: > > > Hi, > > > > I am running my perl script and using some perl modules like below :- > > > > use File::Path qw(mkpath); > > use File::Rsync; > > my $rsync = '/opt/zimbra/rsync/bin/rsync'; > > > > > > when I run the script using > > perl scriptname --> then it runs fine, however when I run through crontab, > > it > > get this error : - > > > > Can't locate File/Rsync.pm in @INC (@INC contains:/etc/perl > > /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 > > /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 > > /usr/local/lib/site_perl .) at /opt/zimbra/lbin/backup.pl line 8. > > > > Any clues ? > > One problem with executing programs using cron is that cron does not execute > your login scripts that setup and customize your interactive session, such > as .profile, .login, .bashrc, or .cshrc, depending upon your shell. > > Do you use any environment variables such as PERL5LIB? Those will not be > set. > > Where is the module File::Rsync located? Type 'perldoc -l File::Rsync' to > find out. > > One workaround is to have cron execute a shell script that sources your > login scripts and then executes your Perl program, something like: > > #!/bin/tcsh > # > source ~user/.login > source ~user/.cshrc > perl scriptname > > (I use tcsh, so the above may not be correct for your shell) > at the risk of starting a flame-war, you should not encourage people to write their scripts in C-shell (not that using it as a login shell is too recommended either), because it is a braindead shell with poorly designed semantics. See: http://www.shlomifish.org/open-source/anti/csh/ I refer there to "Csh programming considered harmful" by Tom Christiansen (who authored large parts of Perl's documentation) to a continuation document by Bruce Barnett and give some other compelling reasons of my own. Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Interview with Ben Collins-Sussman - http://shlom.in/sussman <rindolf> buu: do you have a functional spec? An architecture document? An interface whitepaper? A developer’s guide? A user manual? A “The BL Book” and “BL — The Program”? <buu> rindolf: no, no, no no and no Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
