.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Zoidberg::Shell 3" .TH Zoidberg::Shell 3 "2008-01-12" "perl v5.8.8" "User Contributed Perl Documentation" .SH "NAME" Zoidberg::Shell \- A scripting interface to the Zoidberg shell .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Zoidberg::Shell; \& my $shell = Zoidberg::Shell->current(); .Ve .PP .Vb 3 \& # 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}); .Ve .PP .Vb 2 \& # 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}]); .Ve .PP .Vb 2 \& # Create an alias \& $shell->alias({'ls' => 'ls --color=auto'}); .Ve .PP .Vb 3 \& # 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'}); .Ve .SH "DESCRIPTION" .IX Header "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 \fBparent\fR shell environment like /.*sh/ source scripts do with /.*sh/ environments. .SH "EXPORT" .IX Header "EXPORT" Only the subs \f(CW\*(C`AUTOLOAD\*(C'\fR and \f(CW\*(C`shell\*(C'\fR are exported by default. \&\f(CW\*(C`AUTOLOAD\*(C'\fR works more or less like the one from \fIShell.pm\fR by Larry Wall, but it includes zoid's builtin functions and commands (also it just prints output to stdout see \s-1TODO\s0). .PP All other methods except \f(CW\*(C`new\*(C'\fR and \f(CW\*(C`system\*(C'\fR can be exported on demand. Be aware of the fact that methods like \f(CW\*(C`alias\*(C'\fR can mask \*(L"plugin defined builtins\*(R" 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. .PP The reason the \f(CW\*(C`system\*(C'\fR can't be exported is because it would mask the perl function \f(CW\*(C`system\*(C'\fR, also this method is only included so zoid's DispatchTable's can use it. .PP Also you can import an \f(CW@JOBS\fR from this module. The ':jobs' tag gives you both \f(CW@JOBS\fR and the \f(CW\*(C`job()\*(C'\fR method. .SH "METHODS" .IX Header "METHODS" \&\fBBe aware:\fR All commands are executed in the \fBparent\fR shell environment. .PP \&\s-1FIXME\s0 document the new export tags, document all routines better .ie n .IP """new()""" 4 .el .IP "\f(CWnew()\fR" 4 .IX Item "new()" Simple wrapper for the constructor of the Zoidberg class. .ie n .IP """current()""" 4 .el .IP "\f(CWcurrent()\fR" 4 .IX Item "current()" Returns the current Zoidberg object, which in turn inherits from this package, or undef when there is no such object. .Sp \&\s-1TODO\s0 should also do ipc .ie n .IP """any()""" 4 .el .IP "\f(CWany()\fR" 4 .IX Item "any()" Uses the current shell if any, else starts a new one. .ie n .IP """system($command, @_)""" 4 .el .IP "\f(CWsystem($command, @_)\fR" 4 .IX Item "system($command, @_)" Opens a pipe to a system command and returns it's output. Intended for when you want to call a command \fBwithout\fR using zoid's parser and job management. This method has absolutely \fBno\fR intelligence (no expansions, builtins, etc.), you can only call external commands with it. .ie n .IP """shell($command, @_)""" 4 .el .IP "\f(CWshell($command, @_)\fR" 4 .IX Item "shell($command, @_)" If \f(CW$command\fR is a built-in shell function (possibly defined by a plugin) or a system binary, it will be run with arguments \f(CW@_\fR. The command won't be subject to alias expansion, arguments might be subject to glob expansion. \s-1FIXME\s0 double check this .ie n .IP """shell($string)""" 4 .el .IP "\f(CWshell($string)\fR" 4 .IX Item "shell($string)" Parse and execute \f(CW$string\fR 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. .ie n .IP """shell([$command, @_], [..], 'AND', [..])""" 4 .el .IP "\f(CWshell([$command, @_], [..], 'AND', [..])\fR" 4 .IX Item "shell([$command, @_], [..], 'AND', [..])" Create a logic list and/or pipeline. Available tokens are '\s-1AND\s0', '\s-1OR\s0' and \&'\s-1EOS\s0' (End Of Statement, ';'). .Sp \&\f(CW\*(C`shell()\*(C'\fR allows for other kinds of pseudo parse trees, these can be considered as a kind of \*(L"expert mode\*(R". See zoiddevel(1) for more details. You might not want to use these without good reason. .ie n .IP """set(..)""" 4 .el .IP "\f(CWset(..)\fR" 4 .IX Item "set(..)" Update settings in parent shell. .Sp .Vb 2 \& # merge hash with current settings hash \& set( { noglob => 0 } ); .Ve .Sp .Vb 2 \& # set these bits to true \& set( qw/hide_private_method hide_hidden_files/ ); .Ve .Sp See zoiduser(1) for a description of the several settings. .ie n .IP """setting($setting)""" 4 .el .IP "\f(CWsetting($setting)\fR" 4 .IX Item "setting($setting)" Returns the current value for a setting. .ie n .IP """alias(\e%aliases)""" 4 .el .IP "\f(CWalias(\e%aliases)\fR" 4 .IX Item "alias(%aliases)" Merge \f(CW%aliases\fR with current alias hash. .Sp .Vb 1 \& alias( { ls => 'ls ---color=auto' } ) .Ve .ie n .IP """unalias(@aliases)""" 4 .el .IP "\f(CWunalias(@aliases)\fR" 4 .IX Item "unalias(@aliases)" Delete all keys listed in \f(CW@aliases\fR from the aliases table. .ie n .IP """source($file)""" 4 .el .IP "\f(CWsource($file)\fR" 4 .IX Item "source($file)" Run another perl script, possibly also interfacing with zoid. .Sp \&\s-1FIXME\s0 more documentation on zoid's source scripts .ie n .IP """job($spec)""" 4 .el .IP "\f(CWjob($spec)\fR" 4 .IX Item "job($spec)" Used to fetch a job object by its spec, for example: .Sp .Vb 1 \& $shell->job('%-')->kill(); # kill the previous job .Ve .ie n .IP """AUTOLOAD""" 4 .el .IP "\f(CWAUTOLOAD\fR" 4 .IX Item "AUTOLOAD" All calls that get autoloaded are passed directly to the \f(CW\*(C`shell()\*(C'\fR method. This allows you to use nice syntax like : .Sp .Vb 1 \& $shell->cd('..'); .Ve .SH "JOBS" .IX Header "JOBS" \&\s-1FIXME\s0 splain \f(CW@JOBS\fR .SH "TODO" .IX Header "TODO" An interface to create background jobs .PP An interface to get input .PP Can builtins support both perl data and switches ? .PP Test script .PP More syntactic sugar :) .SH "AUTHOR" .IX Header "AUTHOR" Jaap Karssenberg || Pardus [Larus] .PP 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. .SH "SEE ALSO" .IX Header "SEE ALSO" Zoidberg, Zoidberg::Utils, .PP Shell