tags:

views:

148

answers:

3

I'd like to have all the installed CPAN modules updated automatically every night, so I've placed the following command in the crontab:

@daily cpan -i $(cpanp -o | perl -lane 'print $F[3]')

However, whenever this is run I get the following error message:

Unable to get Terminal Size. The TIOCGWINSZ ioctl didn't work. The COLUMNS and
LINES environment variables didn't work. The resize program didn't work. at
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/Term/ReadKey.pm
line 362.
Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/Term/ReadLine
/Perl.pm line 63.

What can I do to get this working?

+2  A: 

Are you trying to update the list of modules with CPAN or actually update any out of date modules (d/l, compile, install)? This could be dangerous as modules could change interface and existing scripts would fail. This error is due to CPAN trying to use Term::ReadLine and Term::ReadKey to interrogate the terminal.

If you really want to upgrade all your modules, you can use this command:

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

This is a small change from the command given in the documentation to interrogate CPAN for all outdated modules:

http://search.cpan.org/~andk/CPAN-1.9402/lib/CPAN.pm#PROGRAMMER%27S%5FINTERFACE

Wayne Arthurton
So what are the differences between using your command and the one I originally am using?
Kiffin
It calls a method that is part of the Install shell instead of loading the shell and running the command.
Wayne Arthurton
A: 

The COLUMNS and LINES environment variables didn't work.

Try setting the COLUMNS and LINES environment variables.

COLUMNS=80
LINES=24
@daily cpan -i $(cpanp -o | perl -lane 'print $F[3]')
a paid nerd
+2  A: 

Come back on Monday. I'll add a -u command to cpan to do that if you promise to test it for me. You'll have to get the latest cpan from App::Cpan.

Okay, don't wait until Monday. I've pushed the change to the cpan-script Github repo, and App-Cpan 1.56_15 is on its way to CPAN.

Let me know if you have any problems or the new feature doesn't do what you want.

brian d foy
So to install this I only need to download http://search.cpan.org/CPAN/authors/id/B/BD/BDFOY/App-Cpan-1.56_15.tar.gz and do the usual perl Makefile.PL etc. thing?
Kiffin