Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Pressing Delete key ends Term::ReadLine loop

by cord-bin (Pilgrim)
on May 20, 2014 at 17:30 UTC ( #1086832=note: print w/ replies, xml ) Need Help??


in reply to Pressing Delete key ends Term::ReadLine loop

I always use Term::ReadLine in conjunction with Term::Readline::Perl and Term::ReadLine::Gnu, the first one creates an interface for the others and is recommend to install all of them. Here’s a nice shell you can have with Term::ReadLine

use Term::ReadLine; my $shell = Term::ReadLine->new('myshell'); $_ = $shell->Features(); my $history = ${%$_}{autohistory}; $SIG{INT} = 'IGNORE'; while(1) { my $return; $command = $shell->readline('myshell> '); { local $SIG{INT} = sub {die 'End';}; $return = eval($command); } if (!$history) { $term->addhistory($_) if /\S/; } }
You could play with :
myshell> @test = (a,b,c,d) myshell> print "@test"; myshell> a b c d
or
myshell> open OUT, '>/tmp/test'; myshell> print OUT "Hello world !"; close OUT


Comment on Re: Pressing Delete key ends Term::ReadLine loop
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1086832]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (14)
As of 2014-12-18 16:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (58 votes), past polls