man Zoidberg::Shell () - A scripting interface to the Zoidberg shell

NAME

Zoidberg::Shell - A scripting interface to the Zoidberg shell

SYNOPSIS

        use Zoidberg::Shell;
        my $shell = Zoidberg::Shell->current();

        # Order parent shell to 'cd' to /usr
        # If you let your shell do 'cd' that is _NOT_ the same as doing 'chdir'
        $shell->shell(qw{cd /usr});

        # Let your parent shell execute a logic list with a pipeline
        $shell->shell([qw{ls -al}], [qw{grep ^d}], 'OR', [qw{echo some error happened}]);

        # Create an alias
        $shell->alias({'ls' => 'ls --color=auto'});

        # since we use Exporter::Tidy you can also do things like this:
        use Zoidberg::Shell _prefix => 'zoid_', qw/shell alias unalias/;
        zoid_alias({'perlfunc' => 'perldoc -Uf'});

DESCRIPTION

This module is intended to let perl scripts interface to the Zoidberg shell in an easy way. The most important usage for this is to write 'source scripts' for the Zoidberg shell which can use and change the parent shell environment like /.*sh/ source scripts do with /.*sh/ environments.

EXPORT

Only the subs CWAUTOLOAD and CWshell are exported by default. CWAUTOLOAD works more or less like the one from Shell.pm by Larry Wall, but it includes zoid's builtin functions and commands (also it just prints output to stdout see TODO).

All other methods except CWnew and CWsystem can be exported on demand. Be aware of the fact that methods like CWalias can mask plugin defined builtins with the same name, but with an other interface. This can be confusing but the idea is that methods in this package have a scripting interface, while the like named builtins have a commandline interface.

The reason the CWsystem can't be exported is because it would mask the perl function CWsystem, also this method is only included so zoid's DispatchTable's can use it.

Also you can import an CW@JOBS from this module. The ':jobs' tag gives you both CW@JOBS and the CWjob() method.

METHODS

Be aware: All commands are executed in the parent shell environment.

FIXME document the new export tags, document all routines better Simple wrapper for the constructor of the Zoidberg class. Returns the current Zoidberg object, which in turn inherits from this package, or undef when there is no such object. TODO should also do ipc Uses the current shell if any, else starts a new one. Opens a pipe to a system command and returns it's output. Intended for when you want to call a command without using zoid's parser and job management. This method has absolutely no intelligence (no expansions, builtins, etc.), you can only call external commands with it. If CW$command is a built-in shell function (possibly defined by a plugin) or a system binary, it will be run with arguments CW@_. The command won't be subject to alias expansion, arguments might be subject to glob expansion. FIXME double check this Parse and execute CW$string like it was entered from the commandline. You should realise that the parsing is dependent on grammars currently in use, and also on things like aliases etc. Create a logic list and/or pipeline. Available tokens are 'AND', 'OR' and 'EOS' (End Of Statement, ';'). CWshell() allows for other kinds of pseudo parse trees, these can be considered as a kind of expert mode. See zoiddevel(1) for more details. You might not want to use these without good reason. Update settings in parent shell.

        # merge hash with current settings hash
        set( { noglob => 0 } );
        # set these bits to true
        set( qw/hide_private_method hide_hidden_files/ );
See zoiduser(1) for a description of the several settings. Returns the current value for a setting. Merge CW%aliases with current alias hash.
        alias( { ls => 'ls ---color=auto' } )
Delete all keys listed in CW@aliases from the aliases table. Run another perl script, possibly also interfacing with zoid. FIXME more documentation on zoid's source scripts Used to fetch a job object by its spec, for example:
        $shell->job('%-')->kill(); # kill the previous job
All calls that get autoloaded are passed directly to the CWshell() method. This allows you to use nice syntax like :
        $shell->cd('..');

JOBS

FIXME splain CW@JOBS

TODO

An interface to create background jobs

An interface to get input

Can builtins support both perl data and switches ?

Test script

More syntactic sugar :)

AUTHOR

Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>

Copyright (c) 2003 Jaap G Karssenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Zoidberg, Zoidberg::Utils, <http://zoidberg.sourceforge.net>

Shell