Clear questions and runnable code
get the best and fastest answer
What's the connection between the CPAN programming methods to what happens in the CPAN shell?by tphyahoo (Vicar)
|on Aug 23, 2006 at 09:58 UTC||Need Help??|
tphyahoo has asked for the
wisdom of the Perl Monks concerning the following question:
I'm organizing an install script that installs a bunch of CPAN mods, the easy dependencies first, then the harder, with the goal that the whole thing runs at one go and doesn't need to be rerun numerous times while CPAN sorts out the dependencies.
I would like to have something like
force install ('SQL::Translator');or
notest install ('SQL::Translator') or die "died on SQL::Translator"; but that doesn't work from the programming interface, the way it does from the shell. The only method that seems to work from within the API is install ('SQL::Translator')
I suppose I could do system("perl -MCPAN -e 'force install SQL::Translator'"); over and over, or just code the whole thing up in bash, but that seems to be going against the whole spirit of why CPAN was created in the first place.
I guess the deeper issue is that I don't really understand what force/notest exactly are. They're described in the CPAN doc as pragmas, but I don't get it. They seem not to be pragmas in the sense of "strict/warning" which are just modules. That is to say, you can search for strict/warnings modules on CPAN, but not the "force" module. So I guess the meaning of pragma is different here.
What's the underlying model here? What's the connection between the CPAN api methods and commands like "force" and "install" which can be issued from the shell?
By the way, this question applies to CPANPLUS as well as CPAN. Lately I've been switching back and forth between the two, as sometimes the install is easier within one, other times the other.
2006-08-23 Retitled by holli, as per Monastery guidelines