nysus has asked for the wisdom of the Perl Monks concerning the following question:

I have a perl script that asks the user to input a path on the local machine. Looking for a module that implements path tab completion on a Mac. I found Term::BashTab but it doesn't work on a Mac. Anyone know of any modules?

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

  • Comment on Tab completion of path from prompt from within Perl script

Replies are listed 'Best First'.
Re: Tab completion of path from prompt from within Perl script
by hippo (Archbishop) on Aug 17, 2018 at 15:19 UTC

      Worked perfectly. Thanks!

      $PM = "Perl Monk's";
      $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
      $nysus = $PM . ' ' . $MCF;
      Click here if you love Perl Monks

        Glad to hear it. Now I'm going to show you how to fish.

        I was totally unaware of this module prior to this afternoon. To find it I went to https://metacpan.org and in the search box typed "term tab" without pressing return. This popped up a bunch of Term::Table* modules which isn't what we were after, so I deleted the "tab" part and typed "compl" in its place. Click on the first entry which pops up, et voila!

        Now you too will be able to find modules you didn't know existed. Happy Friday.

Re: Tab completion of path from prompt from within Perl script
by LanX (Saint) on Aug 17, 2018 at 15:20 UTC
    The Perl debugger is implementing tab-completion using Term::ReadLine , though not sure if this also works under windows and the API is a bit awkward .

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

    update

    and in 5.18 (linux) at least the debugger resp. Term::ReadLine::Gnu::XS is broken in this respect :/

    DB<1> $xxx=1 #hitting tab after $x DB<2> p $xCan't use string ("::") as a HASH ref while "strict refs" +in use at /usr/share/perl/5.18/perl5db.pl line 9513. at /usr/share/perl/5.18/perl5db.pl line 9513. DB::db_complete('$x', 'p $x', 2) called at /usr/lib/perl5/Term/Rea +dLine/Gnu/XS.pm line 575

    DB::db_complete shows the configuration in the debugger.