Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!bfmny0!tneff From: tneff@bfmny0.UU.NET (Tom Neff) Newsgroups: comp.lang.perl Subject: Re: StreamPerl (Was Re: Randal's one-liners) Message-ID: <15245@bfmny0.UU.NET> Date: 10 Mar 90 04:19:51 GMT References: Reply-To: tneff@bfmny0.UU.NET (Tom Neff) Lines: 35 This is the version of the perl shell (psh) I hack with. It has a couple of features I wanted: * You can dump all the variables: X * You can dump a scalar, quote delimited: p varname (no $ needed) * Result of each op is displayed delimited: '(result=xyzzy)' I'm sure there are a lot more things one could do. Biggest drawback to psh is you can't load packages interactively; it blows up. ----------------------------------------------------------------------- #!/usr/local/bin/perl eval "exec perl -S -s $0 $*" if $running_under_some_shell; do 'dumpvar.pl' || die "No dumpvar.pl: $@\n"; $Prompt = 'psh: '; $Printing = "\n"; print "(Hit X for a dump of variables)\n"; print $Prompt; while() { chop; s/^p ([\w[\]{}']+)$/print q^\$$1=\"^,\$$1,q^\"\n^/; s/^X$/\&dumpvar("main")/; $Pres = eval $_ . ';'; print "(result=$Pres)$Printing" if $Printing; print $@; print $Prompt; } print "\npsh exit\n";