| EB::Shell::DeLuxe - A generic class to build line-oriented command interpreters. |
EB::Shell::DeLuxe - A generic class to build line-oriented command interpreters.
package My::Shell;
use base qw(EB::Shell::DeLuxe);
sub do_greeting { return "Hello!" }
EB::Shell::DeLuxe is a base class designed for building command line programs. It inherits from the EB::Shell::Base manpage.
EB::Shell::DeLuxe extends EB::Shell::Base with the following features:
This implements batch processing in the style of "sh < commands.sh".
All commands are read from the standard input, and processing terminates after the last command has been read.
Commands read this way can be backslash-continued.
This implements command execution in the style of "sh -c 'command'".
One single command is executed.
The constructor is called new. new should be called with a
reference to a hash of name => value parameters:
my $opts = { OPTION_1 => $one, OPTION_2 => $two };
my $shell = EB::Shell::DeLuxe->new($opts);
EB::Shell::DeLuxe extends the options of EB::Shell::Base with:
Controls whether this instance is interactive, i.e, uses ReadLine to read commands.
Defaults to true unless the standard input is not a terminal.
Controls whether this instance executes a single command, that is contained in @ARGV;
@ARGV = ( "exec", "this", "command" ); my $opts = { command => 1 }; my $shell = EB::Shell::DeLuxe->new($opts); $shell->run;
The prompt for commands.
If true, commands read from the standard input are echoed with the value of this option as a prefix. Valid for non-interactive use only.
Johan Vromans <jvromans@squirrel.nl
Copyright (C) 2005,2006 Squirrel Consultancy. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| EB::Shell::DeLuxe - A generic class to build line-oriented command interpreters. |