NAME

Shell::Parser - The great new Shell::Parser!

VERSION

Version 0.01

SYNOPSIS

use Shell::Parser;

my $parser = new Shell::Parser;
$parser->parse(...);

DESCRIPTION

This module implements a rudimentary shell parser in Perl.

METHODS

new()

Options

  • handlers - sets the shell code fragments handlers. See "handlers()" for more information.

  • syntax - selects the shell syntax. See "syntax()" for more information.

Examples

my $parser = new Shell::Parser XXX;
parse()
eof()
handlers()

Sets the shell code fragments handlers. Available handlers:

  • assign - handler for assignments: VARIABLE=VALUE

  • builtin - handler for shell builtin commands: alias, jobs, read...

  • command - handler for external commands

  • comment - handler for comments: # an impressive comment

  • keyword - handler for shell reserved words: for, if, case...

  • metachar - handler for shell metacharacters: ;, &, |...

  • variable - handler for variable expansion: $VARIABLE

  • text - handler for anything else

There is also a default handler, which will be used for any handler which has not been explicitely defined.

See also "Handlers" for more information on how handlers receive their data.

syntax()

Selects the shell syntax. Use one of:

  • bourne - the standard Bourne shell

  • csh - the C shell

  • tcsh - the TENEX C shell

  • korn88 - the Korn shell, 1988 version

  • korn93 - the Korn shell 1993 version

  • bash - GNU Bourne Again SHell

  • zsh - the Z shell

Returns the current syntax when called with no argument, or the previous syntax when affecting a new one.

HANDLERS

To be written.

sub handler {
    my $self = shift;
    my %args = @_;
    
    # do stuff
    # ...
}

AUTHOR

Sébastien Aperghis-Tramoni, <sebastien@aperghis.net>

BUGS

Please report any bugs or feature requests to bug-shell-parser@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE

Copyright 2004 Sébastien Aperghis-Tramoni, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 391:

Non-ASCII character seen before =encoding in 'Sébastien'. Assuming CP1252