nysus has asked for the wisdom of the Perl Monks concerning the following question:
I'm working on a module I want to contribute to CPAN that is essentially a wrapper for the LastPass CLI. I'm struggling to figure out how to create a smooth install process. The tests bundled with module will issue the lpass login USERNAME command. So my tests need to collect the user's Lastpass user name to run the tests.
But I'm running into problems just getting the prompt to show. For example, here is one of my tests:
use Test::Most; use App::lpp; use Term::Prompt; my $tests = 1; # keep on line 17 for ,i (increment and ,d (decrement) diag( "Running tests" ); plan tests => $tests; # create an object my $obj; $| = 1; *OLD_STDOUT = *STDOUT; *STDOUT = *STDERR; my $username = prompt ('x', "Enter your Lastpass username: ", '', ''); *STDOUT = *OLD_STDOUT; lives_ok { $obj = App::lpp->new( {username => $username} ) } 'can crea +te a cmd object';
When the module is installed with cpanm, the prompt doesn't show and to the casual user it just looks like the install script is stuck. I've tried various things (you can see some of my efforts in the test above) to get the prompt to show with cpanm but haven't had any success.
$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting user input during module installation
by nysus (Parson) on Feb 01, 2019 at 13:26 UTC | |
|
Re: Getting user input during module installation
by nysus (Parson) on Feb 01, 2019 at 13:49 UTC | |
by hippo (Archbishop) on Feb 01, 2019 at 15:12 UTC | |
by nysus (Parson) on Feb 01, 2019 at 21:19 UTC | |
by nysus (Parson) on Feb 01, 2019 at 14:00 UTC |