<?xml version="1.0" encoding="windows-1252"?>
<node id="1003557" title="Re: Perl Term::ReadLine::Gnu Signal Handling Difficulties" created="2012-11-13 01:00:01" updated="2012-11-13 01:00:01">
<type id="11">
note</type>
<author id="155876">
Mr. Muskrat</author>
<data>
<field name="doctext">
&lt;p&gt;You access GNU Readline variables through the Attribs method (with the rl_ stripped). [http://search.cpan.org/~hayashi/Term-ReadLine-Gnu-1.20/Gnu.pm#Term::ReadLine::Gnu_Variables|Term::ReadLine::Gnu_Variables]&lt;/p&gt;
&lt;code&gt;
#!/usr/bin/perl
use strict;
use warnings;
use Term::ReadLine;

$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 $term = Term::ReadLine-&gt;new('Term1');
$term-&gt;ornaments(0);
my $attribs = $term-&gt;Attribs;
$attribs-&gt;{catch_signals} = 0; # the default is 1
my $prompt = 'cmd&gt; ';
while ( defined (my $cmd = $term-&gt;readline($prompt)) ) {
    chomp($cmd);
    if ($cmd =~ /^help$/) {
        print "Help Menu\n";
    }
    else {
        print "Nothing\n";
    }
}
&lt;/code&gt;
&lt;p&gt;Update: Added $SIG{INT}&lt;/p&gt;</field>
<field name="root_node">
1003497</field>
<field name="parent_node">
1003497</field>
</data>
</node>
