Term::Shell 0.01 review

Download
by rbytes.net on

Term::Shell is a simple command-line shell framework. SYNOPSIS package MyShell; use base qw(Term::Shell); sub r

License: Perl Artistic License
File size: 17K
Developer: Neil Watkiss
0 stars award from rbytes.net

Term::Shell is a simple command-line shell framework.

SYNOPSIS

package MyShell;
use base qw(Term::Shell);

sub run_command1 { print "command 1!n"; }
sub smry_command1 { "what does command1 do?" }
sub help_command1 {
cmdloop;

Term::Shell lets you write simple command-line shells. All the boring details like command-line parsing, terminal handling, and tab completion are handled for you.
The base class comes with two commands pre-defined: exit and help.

To write a shell with an exec command, do something like this:

package MyShell;
use base qw(Term::Shell); # or manually edit @MyShell::ISA.

sub run_exec {
my ($o, $cmd, @args) = @_;
if ($cmd ne $0) {
print "I'm sorry you're leaving us...n";
}
exec $cmd, @args;
exit 1;
}

When Term::Shell needs to handle the exec command, it will invoke this method. That's all there is to it! You write handlers, and Term::Shell handles the gory details.

Requirements:
Perl

Term::Shell 0.01 search tags