psh - Perl Shell
psh
A fairly simple read-eval loop. The -w flag and 'use strict' are not employed so that the user is not bound by their stipulations. Setting $^W = 1 will turn on warnings, and calling '<use strict>' will do the usual thing if called by the user.
-w
use strict
$^W = 1
Each line of input is read and immediately evaluated.
Multiline input may be entered by starting with a line like <<XXX, followed by lines of input not having XXX on a line by itself, followed by such a line. If XXX is not specified, then the first blank line terminates the input.
<<XXX
XXX
An input line beginning with `!' will be given as a parameter to the system() Perl function.
system()
An input line beginning with `.' followed by a space and a file name will cause the contents of the specified file to be read in and evaluated.
If $ENV{HOME} is set, and the file $ENV{HOME}/.pshrc is present, it will be read in and evaluated before processing begins. If not, but <.pshrc> is present in the current directory, it will be read and executed.
$ENV{HOME}
$ENV{HOME}/.pshrc
Setting the variable $psh::prompt to a string will cause that string to be used as the prompt-string. Setting it to a subroutine reference causes the result of running that subroutine to be used each time. For example,
$psh::prompt
$psh::prompt = sub { $i++; "psh [$i]\$ "; }
will cause the prompt to be psh [1]$ followed by psh [2]$, and so on.
psh [1]$
psh [2]$
The loop inside psh will clobber $1 and other variables because it uses matches to implement some of its special functions.
$1
Very little error checking is done.
.pshrc - The user's Perl Shell `profile'. May be in $HOME or the current directory.
.pshrc
$HOME
Gregor N. Purdy, gregor@focusresearch.com
gregor@focusresearch.com
Copyright (C) 1999 Gregor N. Purdy. All rights reserved. This script is free software. It may be copied or modified according to the same terms as Perl itself.
To install psh, copy and paste the appropriate command in to your terminal.
cpanm
cpanm psh
CPAN shell
perl -MCPAN -e shell install psh
For more information on module installation, please visit the detailed CPAN module installation guide.