Autoupdate

gnat on 2002-05-15T03:58:40

Is there a script I can run from cron that will automatically update my modules from CPAN? I know it's a security risk, but given that my modus operandi is to say:

% sudo perl -MCPAN -e shell
cpan> install Module::Foo
and I automatically follow prerequisites, I figure I'm already at the mercy of anyone who maintains the modules I already have. There's nothing preventing them from changing the Makefile.PL of their new release to drop my /etc/passwd into the mail for them, or add a new account, or even just require Nat::You've::Been::R00ted.

Why do I want this? I'm working an hour a night on the next edition of the Perl Cookbook, and I'm doing SOAP stuff. I want to test code, which means I need SOAP::Lite installed, which means I need ... and suddenly the world of dependencies is opening before me. And when I did an r in CPAN shell to see what else I should update ... aiee! Leave a machine a month and it becomes a bloody fossil!

--Nat


use a Bundle

hfb on 2002-05-15T04:12:33

Use autobundle from the list of the modules you want up to date and then just write a cheap script to install them into a temp and non-priv location if you don't want to run it as root. See the CPAN FAQ and the CPAN.pm docs :)

Easiest...

koschei on 2002-05-15T06:06:13

Easiest method is probably to use CPANPLUS and rip the code for the 'o' command (CPAN.pm's 'r'). That'll get you a list of modules. Then you just need to run an install for each one. Shouldn't be too hard.

Autoupdate oneliner

briac on 2002-05-15T06:37:13

/usr/bin/perl -MCPAN -e 'CPAN::Shell->install(CPAN::Shell->r)'

24 strokes!

jdavidb on 2002-05-15T13:33:12

C<install> is exported by default, so you can just install(CPAN::Shell->r).