Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Testing CPAN module that requires credentials

by DrHyde (Prior)
on Jan 10, 2012 at 10:10 UTC ( #947125=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Testing CPAN module that requires credentials
in thread Testing CPAN module that requires credentials

Don't.

Doing your own prompting and reading from STDIN is bad practice. Instead use ExtUtils::MakeMaker's prompt() subroutine. It will cope properly with things like buffering when CPAN.pm's output is being piped to tee(1) or if it is being driven by Expect, and with the user setting PERL_MM_USE_DEFAULT.


Comment on Re^3: Testing CPAN module that requires credentials
Download Code
Re^4: Testing CPAN module that requires credentials
by Anonymous Monk on Jan 10, 2012 at 10:29 UTC

    A better idea, don't prompt at all, no matter what :)

    Simply document the appropriate enviroment variable

    $ENV{PERL_MYCPANMODULE_CONFIG}='foo.yaml'; $ENV{PERL_MYCPANMODULE_USERPASS}='user:pass';

    Or Makefile.PL switch

    perl Makefile.PL --userpass=user:pass
    and then Makefile.PL stores that in MYCPANMODULE.ini next to Makefile.PL for use during  make test or some such

    I believe Module::Build provides something out of the box for this way, I might be wrong

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://947125]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (15)
As of 2015-07-06 20:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (81 votes), past polls