1PERLSH(1)             User Contributed Perl Documentation            PERLSH(1)
2
3
4

NAME

6       perlsh - one-line perl evaluator with line editing function and
7                variable name completion function
8

SYNOPSIS

10         perlsh
11

DESCRIPTION

13       This program reads input a line, and evaluates it by perl interpreter,
14       and prints the result.  If the result is a list value then each value
15       of the list is printed line by line.  This program can be used as a
16       very strong calculator which has whole perl functions.
17
18       This is a sample program Term::ReadLine::Gnu module.  When you input a
19       line, the line editing function of GNU Readline Library is available.
20       Perl symbol name completion function is also available.
21
22       Before invoking, this program reads ~/.perlshrc and evaluates the
23       content of the file.
24
25       When this program is terminated, the content of the history buffer is
26       saved in a file ~/.perlsh_history, and it is read at next invoking.
27

VARIABLES

29       You can customize the behavior of "perlsh" by setting following
30       variables in ~/.perlshrc;
31
32       $PerlSh::PS1
33           The primary prompt string.  The following backslash-escaped special
34           characters can be used.
35
36                   \h: host name
37                   \u: user name
38                   \w: package name
39                   \!: history number
40
41           The default value is `"\w[\!]$ "'.
42
43       $PerlSh::PS2
44           The secondary prompt string.  The default value is `"> "'.
45
46       $PerlSh::HISTFILE
47           The name of the file to which the command history is saved.  The
48           default value is "~/.perlsh_history".
49
50       $PerlSh::HISTSIZE
51           If not "undef", this is the maximum number of commands to remember
52           in the history.  The default value is 256.
53
54       $PerlSh::STRICT
55           If true, restrict unsafe constructs.  See "use strict" in perl man
56           page.  The default value is 0;
57

FILES

59       ~/.perlshrc
60           This file is eval-ed at initialization.  If a subroutine
61           "afterinit" is defined in this file, it will be eval-ed after
62           initialization.  Here is a sample.
63
64                   # -*- mode: perl -*-
65                   # decimal to hexa
66                   sub h { map { sprintf("0x%x", $_ ) } @_;}
67
68                   sub tk {
69                       $t->tkRunning(1);
70                       use Tk;
71                       $mw = MainWindow->new();
72                   }
73
74                   # for debugging Term::ReadLine::Gnu
75                   sub afterinit {
76                       *t = \$PerlSh::term;
77                       *a = \$PerlSh::attribs;
78                   }
79
80       ~/.perlsh_history
81       ~/.inputrc
82           A initialization file for the GNU Readline Library.  Refer its
83           manual for details.
84

SEE ALSO

86       Term::ReadLine::Gnu <http://search.cpan.org/dist/Term-ReadLine-Gnu/>
87
88       GNU Readline Library
89       <https://tiswww.cwru.edu/php/chet/readline/rltop.html>
90

AUTHOR

92       Hiroo Hayashi <hiroo.hayashi@computer.org>
93
94
95
96perl v5.38.0                      2023-07-24                         PERLSH(1)
Impressum