Gregor N. Purdy, Sr. > psh > pshconfig

Download:
psh-1.8.1.tar.gz

Annotate this POD

CPAN RT

New  2
Open  1
View/Report Bugs
Source  

NAME ^

pshconfig - Configuring the Perl Shell

SYNOPSIS ^

How to configure the Perl Shell

DESCRIPTION ^

Perl Shell uses a built-in, unified configuration system. All essential configuration is done by choosing a set of evaluation strategies, using the strategy builtin, or by setting options, using the option builtin.

CONFIGURATION OPTIONS

All options marked as (ENV) inherit their settings from the current environment.

All options marked as (EARLY) must be set in the pshrc file or earlier to be evaluated.

PROMPT STRINGS ^

Setting the variable ps1 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,

  option ps1= sub { $i++; "psh [$i]\$ "; }

will cause the prompt to be psh [1]$ followed by psh [2]$, and so on.

psh uses some of the same ``prompting variables'' as bash. They are accessed by placing a backslash followed by the code in the prompt string, either hard coded, or as returned by the prompt string function. The variables supported are:

d The date in ``Weekday Month Day'' format
E The escape character
h The short hostname
H The long hostname
n A carriage return and line feed
s The name of the shell
t The current time in HH:MM:SS format
u The username of the current user
w The current working directory
W The basename of the current working directory
# The command number of the current command
$ `#' if the effective UID is zero, else `$'
[ ] Used for Term::ReadLine::Gnu to ignore control characters while determining the length of the prompt

Please note that bash's support of backticks to execute code from within the prompt is not supported in psh. Instead use the newer syntax \$(command) which is also support by bash.

Custom prompting variables may be added by adding entries to the array %Psh::prompt_vars keyed by the single character code. The entries should be subroutine references that return the replacement string.

PSH SCALAR VARIABLES ^

psh makes a number of variables and functions accessible to the user in the Psh:: package for configuration or utility purposes. Their default values are given in parentheses below. If the variable is also marked "[late]", then it is undefined at the start of the .pshrc file, but any value given to it during that file will be used instead of the default setting.

$Psh::bin (the basename of the file psh was invoked by)

The name of the current shell.

$Psh::cmd

The command serial number in the currently-executing processing loop.

$Psh::currently_active (0)

The pid of the process psh will currently forward signals to, or 0 if psh will handle the signals internally. Usually 0 unless psh is waiting for a process in the "foreground".

$Psh::debugging (the value of the -d option or 0)

Whether psh's internal debugging output should be produced. If this variable is set to 1, all available debug output will be shown. If this is set to a string to characters, only debug output belonging to the classes signified by the characters will be shown. Debug classes etc. are in pshdevel

$Psh::eval_preamble ("package main;")

Every Perl expression that psh evaluates as part of its read-eval loop is prepended with this string, intended primarily to set the expected package context.

$Psh::host (the output of "hostname -s") [late]

The short host name of the machine psh is currently running on.

$Psh::interactive

This is not a customization variable but a flag which tells wether you are currently in interactive mode (1) or processing a file (0)

$Psh::login_shell (0)

Set to true if psh is the user's login shell. On systems where this does not apply, set to true unless called from another instance of psh.

$Psh::longhost (the output of "hostname") [late]

The fully qualified host name of the machine psh is running on.

$Psh::result_array ('Psh::val')

Controls where the results of Perl evaluations saved via $Psh::echo will go. It may be a reference to an array, or the string name of an array.

$Psh::which_regexp ('^[-a-zA-Z0-9_~+]*$')

When Psh::Util::which is asked to locate a filename in the current PATH, it will only look for filenames which match this regexp. Names that do not match this regexp will automatically come back "not found".

PSH ARRAY VARIABLES ^

@Psh::Completion::bookmarks ( from /etc/hosts )

Supposed to contain your most used IP numbers, hostnames or URLs. Those will be eligible for TAB completion if you add a command for completion using complete -A hostname command. psh will initialize this list with your /etc/hosts file

@Psh::history

An array of lines to write to the history file when psh exits, only filled when the ReadLine module doesn't handle the history file.

@Psh::val

The default array where psh stores away the results of executing lines, as described in $Psh::echo above.

PSH HASH VARIABLES ^

%Psh::Prompt::prompt_vars

The keys of this hash are single characters, and the values are subroutine references that implement the given escape character in prompt strings. (See "PROMPT STRINGS" below.)

COPYRIGHT ^

Copyright (C) 1999-2003 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.

syntax highlighting: