On 12-06-03 03:01 AM, Octavian Rasnita wrote:
So for running cron jobs with a version of Perl installed by Perlbrew, I
just needed to add the following lines at the start of cron script:

PERL5LIB=/home/teddy/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2:/home/teddy/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2


PATH=/home/teddy/perl5/perlbrew/bin:/home/teddy/perl5/perlbrew/perls/perl-5.14.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin


That's all.

The advantage is that when you'll install a new version of Perl with
Perlbrew, you will just need to change 2 lines in cron, and not all the
Perl programs.

Which you have to do for every cron script. And you're not using perlbrew; you're bypassing it and doing one of its task manually. To use perlbrew in your cron scripts, replace the above two lines with:

# perlbrew
if [ -e /home/teddy/perl5/perlbrew/etc/bashrc ]
then
        source /home/teddy/perl5/perlbrew/etc/bashrc
fi

Now, after you do a `perlbrew switch ...` the next time the cron script starts, it will use the new perl. Which is what using perlbrew means; the ability to change the perl version without changing all your scripts.


--
Just my 0.00000002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

        _Perl links_
official site   : http://www.perl.org/
beginners' help : http://learn.perl.org/faq/beginners.html
advance help    : http://perlmonks.org/
documentation   : http://perldoc.perl.org/
news            : http://perlsphere.net/
repository      : http://www.cpan.org/
blog            : http://blogs.perl.org/
regional groups : http://www.pm.org/

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to