Subject: | cpanp always returns true when run in batch mode |
Date: | Mon, 22 Jun 2009 14:12:37 -0400 |
To: | bug-cpanplus [...] rt.cpan.org |
From: | Phillip Moore <pmoore6448 [...] gmail.com> |
Using cpanp from the perl-5.10.0 distribution, with no custom configuration
whatsoever, I've found that it returns useless exit codes.
root@efs-as5-3$ cpanp i Errno
[MSG] No '/root/.cpanplus/custom-sources' dir, skipping custom sources
[ERROR] 'Errno' does not contain an author part
[ERROR] Cannot find 'Errno' in the module tree
No such module: Errno
No modules found to operate on!
Nothing done
[PWD = /home/pmoore/dev/efs/core/branches/test-suite-rewrite]
root@efs-as5-3$ echo $?
0
This makes it very difficult to script installation, when you can't depend
on the exit status to give you basic pass/fail information.
The API return values are correct, though:
root@efs-as5-3$ perl -MCPANPLUS -de 0
Loading DB routines from perl5db.pl version 1.3
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(-e:1): 0
DB<1> $bool = install('Errno');
[MSG] No '/root/.cpanplus/custom-sources' dir, skipping custom sources
[ERROR] No such module 'Errno'
DB<2> x $bool
0 undef
At least you get a false value when the installation fails. It would be
nice if this were propogated to the exit value when cpanp is run
non-interactively from the shell.