in reply to Term::Shell readline

Version 0.02 of Term::Shell is from 2007. So yeah, upgrading it might be a start.

If the script dies from the commandline and works from the debugger, then probably the debugger brings a library into the mix which makes the script work because it is there before you create your object. Your example code uses SH::Shell, a module unknown to me (and to CPAN), so I can't help much further.

A shot in the dark: Do you have Term::ReadLine::Gnu installed? Or any other Term::Readline backends?

Replies are listed 'Best First'.
Re^2: Term::Shell readline
by Anonymous Monk on Mar 08, 2023 at 22:15 UTC

    Thank you very much, haj! I have requested a module version upgrade! That's a good point which I should have mentioned. SH::Shell is just a company-specific perl module which inherits from Term::Shell. I am not sure whether I have those installed. Is there an easy way to check ?

    package SH:Shell; use base qw(Term::Shell); sub init { ## good stuff of course }

      When I list the subroutines in the debugger, it seems it's listed, so maybe I just need to force load this in the init subroutine?

      DB<2> S Term::ReadLine Term::ReadLine::BEGIN Term::ReadLine::Gnu::AU::AUTOLOAD Term::ReadLine::Gnu::AU::BEGIN Term::ReadLine::Gnu::AU::__ANON__[//ms/dist/perl5/PROJ/Term-ReadLine-G +nu/1.35-6.2-5.26/lib/perl5/Term/ReadLine/Gnu.pm:848] Term::ReadLine::Gnu::AddHistory Term::ReadLine::Gnu::Attribs Term::ReadLine::Gnu::BEGIN Term::ReadLine::Gnu::CallbackHandlerInstall Term::ReadLine::Gnu::DESTROY Term::ReadLine::Gnu::Features Term::ReadLine::Gnu::GetHistory Term::ReadLine::Gnu::IN Term::ReadLine::Gnu::ISFUNC Term::ReadLine::Gnu::ISKMAP Term::ReadLine::Gnu::ISMACR Term::ReadLine::Gnu::MULT_MATCH Term::ReadLine::Gnu::MinLine Term::ReadLine::Gnu::NO_MATCH Term::ReadLine::Gnu::OUT

        For a quick check, try:

        perl -MTerm::ReadLine sh.pl

        This will pull in Term::ReadLine and probably also Term::ReadLine::Gnu before your company init stuff. Note that you can not load Term::ReadLine::Gnu directly!