in reply to Perl REPLs

My repl is basically the same 15 line perl script I wrote nearly 15 years ago. 3 years ago it looked like this.

Today, it looks like this:

C:\test>type \perl64\bin\p1.pl #! perl -slw use 5.010; no warnings 'portable'; use feature qw[ say state ]; use threads; use threads::shared; #use strict; #use Win32::API::Prototype; use Time::HiRes qw[ time sleep ]; use Benchmark qw[cmpthese]; use Data::Dump qw[ pp ]; ##$Data::Dump::MAX_WIDTH = 200; #use Data::Dumper; use Devel::Size qw[ size total_size]; use List::Util qw[ sum reduce max min maxstr minstr shuffle ]; sub mem{ `tasklist /nh /fi "PID eq $$"` =~ m[(\S+ K)$] } $| = 1; $" = $, = ' ';#" $TOOK = 0; my( $took, $start, $end ) = ( '', 0, 0 ); while( 1 ) { $took = $TOOK ? $end - $start : ''; $_code = ''; printf "[%s]{%s} Perl> ", $! || $@ || $? || 0, $took; $_code .= <STDIN> until $_code =~ m[;;\s*$]; chomp $_code; system 1, 'cmd /k' and next if $_code =~ m[^!!;;\s*$]s; if( $_code =~ m[^!(.+);;\s*$]s ) { my $cmd = $1; $cmd =~ s[(\$\w+)][$1]gee; system "cmd.exe /c $cmd"; $! = ($? << 8); next; } last if $_code =~ m[^(quit|exit|q);;\s*$]; $! = 0; # eval { local $ENV{ PERL_SIGNALS } = 'unsafe'; local $SIG{ INT } = sub{die;}; $start = time; eval $_code; $end = time; # }; }

It has at various times had more preloaded stuff, and less; and more and less logic in the loop, but the core 10 or so lines have barely changed at all.

It has never, and will never be published because then someone would want it to "work properly with lexical variables"; "automatically print the results of every evaluation"; and "support strict"; etc. All Of which I have no need for, nor the desire to complicate my single most used perl script ever, by adding.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Perl REPLs
by Discipulus (Canon) on Nov 04, 2016 at 09:02 UTC
    thanks!

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

      Sorry, but my repl still isn't available anywhere. If you download a copy, it becomes your repl; not mine. I hope you understand the difference.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
      In the absence of evidence, opinion is indistinguishable from prejudice.
Re^2: Perl REPLs
by RonW (Parson) on Nov 03, 2016 at 19:02 UTC

    Very useful. Thanks.