#!/usr/bin/perl use strict; use warnings; BEGIN { $ENV{PERL_RL} = 'Gnu'; # or 'Perl' to force which one to use } use Term::ReadLine; use Signal::Safety; my $term = Term::ReadLine->new('Term1'); print "Readline: ", $term->ReadLine, "\n"; $term->ornaments(0); my $attribs = $term->Attribs; $attribs->{catch_signals} = 0; $SIG{TERM} = sub { print "I got a TERM\n"; exit; }; $SIG{INT} = sub { print "I got a INT\n"; exit; }; # add any additional signal handlers you want my $prompt = 'cmd> '; my $cmd = ''; while ( defined $cmd ) { { local $Signal::Safety = 0; # limit the use of unsafe signals $cmd = $term->readline($prompt); } chomp($cmd); if ($cmd =~ /^help$/) { print "Help Menu\n"; } else { print "Nothing\n"; } }