NAME
Zoidberg - a modular perl shell
SYNOPSIS
You most likely want to use the default config files as installed by the ProgramFiles package and all the modules from the Zoidberg package.
use Zoidberg;
# set config
my $fluff_conf = {
'prefix' => '/usr/local',
# $prefix/share/zoid/... expected to exist
'config_dir' => '/home/my_user/.zoid',
'config_file' => 'profile.pd',
'core_file' => 'core.pd',
'grammar_file' => 'grammar.pd',
'cache_file' => 'var/cache.pd',
};
# create and init parent object
my $cube = Zoidberg->new;
$cube->init($fluff_conf);
# start interactive mode
$cube->main_loop;
# exit nicely
my $exit = $cube->round_up ? 1 : 0;
exit $exit;
PROJECT
Zoidberg provides a shell written in perl, configured in perl and operated in perl. It is intended to be a replacement for bash in the future, but that is a long way. Most likely you will have to be a perl programmer or developer to enjoy this.
DESCRIPTION
This class provides a parent object in charche of a whole bunch of plugins. Most of the real functionality is put in this plugins. Also this class is in charche of broadcasting events. Stubs are provided for core plugins. This class autoloads plugin names as subroutines.
EXPORT
None by default.
METHODS
Some usefull methods:
- new()
-
Simple constructor
- init(\%config)
-
Initialize secondary objects and set config
- main_loop()
-
Spans interactive shell reading from secondary object 'Buffer' or from STDIN.
- list_objects()
-
List secondary objects.
- object($zoidname)
-
Returns secondary object stored under $zoidname.
- test_object($zoidname, $class)
-
Returns true if object $zoidname exists and is blessed as $class
- list_aliases()
-
List aliases in grammar -- used to generate help function
- print($ding, $type, $options)
-
USE this in secondary objects ! Fancy print function -- used by plugins to print instead of perl function "print" It uses Data::Dumper for complex data $ding can be ref or string of any kind $type can be any string and is optional examples are: "debug", "message", "warning" and "error" $type also can be an ansi color. $options is an string containing chars as option switches n : put no newline after string m : force markup s : data is ref to array of arrays of scalars -- think sql records
- ask($question)
-
Does a read with $question as prompt -- returns answer
- abs_path($file, $reference)
-
Returns the absolute path for possible relative $file $reference is optional an defaults to $ENV{PWD}
- scan_dir($dir)
-
Returns contents of $dir as a hash ref containing : 'files' => [@files], 'dirs' => [@dirs], 'rest' => [@rest], 'rest' are all files that are not (a symlink to) a file or dir
- exit()
-
Called by plugins exit zoidberg -- this end a main_loop loop
- broadcast_event($$event_name, @args)
-
Let all who are interrested know that event $event has taken place under conditions @args
- register_event($event_name, $zoid_name)
-
register object $zoid_name for event $event_name
- unregister_event($event_name, $zoid_name)
-
unregister object $zoid_name for event $event_name
- registered_events($zoid_name)
-
list events for object $zoid_name
- registered_objects($event_name)
-
list objects for event $event_name
- unregister_all_events($zoid_name)
-
unregister object $zoid_name for all events
- init_postponed($zoidname, $class, @args)
-
initialise a secundary object under name $zoidname of class $class and with arguments @args
AUTHOR
Jaap Karssenberg || Pardus [Larus] <j.g.karssenberg@student.utwente.nl>
R.L. Zwart, <carlos@caremail.nl>
Copyright (c) 2002 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 http://www.perl.com/language/misc/Artistic.html