MAJOR=4
MINOR=11
DEVNAME=tty11
     	ˆÃÂÇ437Á¾Ä µ    	‹      ½“ÁoÛ Æïý+‡ÝÂk—î²b¦ÎŽ´hi¥®ªiÚ� 6¨¶±à­Yû×Ç‰ÚI­¦¶ûïû>€¿)Vyùu=#ŸË«Yß|ZÌsB' ·Ó (‹ñÇ9;=˜-)¡±ÿ °ÛíØnÊ|¨¡Ü€Å¶9‡ˆÁ)d5'|ø&N·Fê4Ž#æ�6?‰¯ø�6ïŽhßFˆ¦Ó•kÓ¦õÌF¦¼ïSíUœÄØé$Û”TÖ€ŒÑ`ZÛ¯î†ê~ÊN!~á06M2à ƒo½~ä�ýo)©ã>¹Ý+Ê 8Zr/WwEßSÁ][“TFÁ)ßEØ6²»cµ«(‘fôÛ<_}O V.‰¦ÊèÇ<[^¬²‚Š¥lù2s•˜K*2"i½v•3úUøz„¯Ýãë#S˜¨‚ëÑùî	…dñ¹Uå›ØËäõ}r`ÃsjDôŸÒ�ê·0Ö—›Ù²,æ›1=lñ¤îß,kL‡¤pÁ(ôáá`~Tò¶ÛÆþâ8%kÁÕ© dB^$ÿ&58Ü'û‹Ía|w¿ 1ÕæÕÚ    7   ˆl–Ü4ý(T¾R( JÛ€jà�S�ÿ�þYrGÖl¥,®‰¹[!üÿÉ„@h?È¿Å 6Ù    #!/usr/bin/perl
#
#
#       Copyright (c) 1996 Hiroo Hayashi. All Rights Reserved.
#
#       This program is free software; you can redistribute it and/or
#       modify it under the same terms as Perl itself.

=head1 NAME

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

=head1 SYNOPSIS

  perlsh

=head1 DESCRIPTION

This program reads input a line, and evaluates it by perl interpreter,
and prints the result.  If the result is a list value then each value
of the list is printed line by line.  This program can be used as a
very strong calculator which has whole perl functions.

This is a sample program Term::ReadLine::Gnu module.  When you input a
line, the line editing function of GNU Readline Library is available.
Perl symbol name completion function is also available.

=cut

package PerlSh;

use strict;
use warnings;
use Term::ReadLine;
use POSIX;                      #  for sigaction below

use vars qw($PS1 $PS2 $HISTFILE $HISTSIZE $INPUTRC $STRICT
            $HOSTNAME $LOGNAME $CWP);

#$PS1 = '$ ';
$PS1='\w[\!]$ ';
$PS2 = '> ';
$HISTFILE = ($ENV{HOME} || ((getpwuid($<))[7])) . "/.perlsh_history";
$HISTSIZE = 256;
$INPUTRC = ($ENV{HOME} || ((getpwuid($<))[7])) . "/.perlshrc";
$STRICT = 0;

$HOSTNAME = $ENV{HOSTNAME};
$LOGNAME = $ENV{LOGNAME};
$CWP = 'main';                  # current working package

package main;
if (-f $PerlSh::INPUTRC) {
    do $PerlSh::INPUTRC;
}

package PerlSh;

use vars qw($term $attribs);    # to access as `$PerlSh::term' from prompt
$term = new Term::ReadLine 'PerlSh';
$attribs = $term->Attribs;

$term->bind_key(ord "^", 'history-expand-line', 'emacs-meta');
$term->bind_key(ord "\cv", 'display-readline-version', 'emacs-ctlx');
$term->bind_key(ord "\cc", 'abort'); # not works yet FIXME!!!

if (defined &main::afterinit) {
    package main;
    &afterinit;
    package PerlSh;
}

&toplevel;                      # never returns

########################################################################
sub toplevel {
    # disable implicit add_history() call
    $term->MinLine(undef);

    $term->stifle_history($HISTSIZE);
    if (-f $HISTFILE) {
        $term->ReadHistory($HISTFILE)
            or warn "perlsh: cannot read history file: $!\n";
    }
    $attribs->{attempted_completion_function} = \&attempt_perl_completion;
    $attribs->{special_prefixes} = '$@%&';
    $attribs->{completion_display_matches_hook}
        = \&perl_symbol_display_match_list;

    # See http://perldoc.perl.org/perlipc.html#Deferred-Signals-%28Safe-Signals%29
    # was '$SIG{INT} = sub { ...'
    sigaction SIGINT, new POSIX::SigAction sub {
        $term->modifying;
        $term->delete_text;
        $attribs->{point} = $attribs->{end} = 0;
        $term->redisplay;
    } or die "Error setting SIGINT handler: $!\n";

    my ($strict, $command, @result);
    $strict = $STRICT ? '' : 'no strict;';
    while (defined($command = &reader)) {
        @result = eval ("$strict package $CWP; $command");
        use strict;
        if ($@) { print "Error: $@\n"; next; }
        printer (@result);
        $CWP = $1 if ($command =~ /^\s*package\s+([\w:]+)/);
    }
    &quit;
}

sub sigint {
    $term->modifying;
    $term->delete_text;
    $attribs->{point} = $attribs->{end} = 0;
    $term->redisplay;
}

sub quit {
    $term->WriteHistory($HISTFILE)
        or warn "perlsh: cannot write history file: $!\n";
    exit (0);
}

sub reader {
    my ($line, $command);
    $command = '';
    while (1) {
        $line