EB::Shell::DeLuxe.3pm

Langue: en

Autres versions - même langue

Version: 2008-08-30 (ubuntu - 07/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

EB::Shell::DeLuxe - A generic class to build line-oriented command interpreters.

SYNOPSIS

   package My::Shell;
 
   use base qw(EB::Shell::DeLuxe);
 
   sub do_greeting {
       return "Hello!"
   }
 
 

DESCRIPTION

EB::Shell::DeLuxe is a base class designed for building command line programs. It inherits from EB::Shell::Base.

Features

EB::Shell::DeLuxe extends EB::Shell::Base with the following features:
Reading commands from files
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.

Single command execution
This implements command execution in the style of ``sh -c 'command'''.

One single command is executed.

METHODS

new
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:

interactive
Controls whether this instance is interactive, i.e, uses ReadLine to read commands.

Defaults to true unless the standard input is not a terminal.

command
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;
 
 
prompt
The prompt for commands.
echo
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.

AUTHOR

Johan Vromans <jvromans@squirrel.nl<gt> 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.

POD ERRORS

Hey! The above document had some coding errors, which are explained below:
Around line 271:
You forgot a '=back' before '=head1'