Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: command recall

by ahunter (Monk)
on Feb 12, 2001 at 14:53 UTC ( #57871=note: print w/ replies, xml ) Need Help??


in reply to command recall

There isn't really an easy way you can send the command to a shell for editting (the only way I could think of was using ptys, and that would be overkill for such a little script :-)

However, help is at hand in the form of Term::ReadLine, which can be used to create a line editor similar to that used by shells like bash:

use strict; use Term::ReadLine; my $term = new Term::ReadLine 'readline demo'; my $line = $term->readline(">> "); print "Line was: $line\n";
Although note that the capabilities tend to vary depending on how your version of perl was compiled, as the readline library is not always available.

Andrew.


Comment on Re: command recall
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2015-07-08 04:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls