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


In reply to Getting user input during module installation by nysus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.