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


NAME

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

Back to Top


SYNOPSIS

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

Back to Top


DESCRIPTION

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

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.

Back to Top


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.

Back to Top


AUTHOR

Johan Vromans <jvromans@squirrel.nl

Back to Top


COPYRIGHT

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.

Back to Top

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