Tuesday, September 29, 2009

Perl Devel::REPL take-2

It occurred to me that there was an alternative to the big make: just fake the install by taking whatever had made from ./cpan/build and placing the contents of each of those ./lib in their respective places in ./perl/lib

Then just run legitimate calls to Devel::REPL in a Perl script and address the make of the missing pieces one at a time.

It seems to work.  The cpan shell is able to install MOP, for example.  Many of the missing pieces blocked by the circular dependencies and recursing make loops are just odds-and-ends.

I came back to Devel::REPL because each alternative that I looked at could not cope with the simple fact that Perl print returns 1 (in some scripting languages, such as REBOL, print returns no value - it just has a side-effect - it prints!)  And they each had other quirks (PerlConsole has the virtue of no docs, so you read the code until ah-hah (tip: you must use my for variable assignments to pass through).)

 use PerlConsole::Console;
 my $cons = PerlConsole::Console->new;
 while(true) {
    $cons->interpret($cons->getInput);
 }
 # exit with  :quit

CPAN, Perl and the elusive Devel::REPL

Over at make-config.net I am hoping to get a new version of ClassPath Canuck available soon.

In the meantime I have had to go back to Perl for some aule-browser tasks and I thought I would try to use something lighter-weight than an IDE or Emacs since my Perl is a little rusty.

I chose to build Devel::REPL from CPAN because of the 4 articles that accompany its design.

And then a fateful decision: I decided to build it in Cygwin.  Over an hour later I hit a circular dependency in CPAN.

So then I went to a Win XP cmd prompt.  Now CPAN refused to run because it could not be satisfied with my Mingw gcc.  After a trip to refresh Win32 Perl at ActiveState.com I gave up on launching the CPAN shell from with perl and opted for the cpan.bat file.  That little gem decided to install a Mingw and a dmake.  Oh vey.  The ENV var CC and GCC are pointing into a mingw bin and it is up front on the path.  But ActiveState offers to install a gcc and a dmake, so I let it have a whirl. What the heck.  These are the Perl experts.

My first test when the cpan shell exited was to launch it again with cpan.bat and request
   make Moose
This finally failed on missing prereq's - dependencied which the Cygwin cpan make had pulled in just fine. Go figger.  You can only enter 'y' for 'yes' so many times ...

Next attempt:
  make Devel::REPL
That when into a loop on a circular dependency for cpan\build\ExtUtils-Depends-0.302-eJL_dD

Time to rant.

Once we had ICON, the Perl language could have gone away.  We have REBOL parse, but Perl does not go away.  We have Parser Expression Grammars for Ruby and Python.  For Tk we have elegant Python Tkinter.  And we still have Tcl's gift, Expect.  But still, Perl does not go away.

A basic REPL in Perl can be a one-liner and that can be wrapped in rlwrap to provide a command line history so this Devel::REPL is not needed.

I might try this later on a Linux box or try perlconsole or another shell - or just use Perl Express.  I could even use emacs even here on Windows.

But how byzantine has a language become when to build a well-publicized REPL is such a task?  Perl, after all - perl - that is - is just an interpreter.  It is not an environment. It requires no VM.

If this is what the "souk" or the "public market" achieves then perhaps we should remember that we are not always trying to to build a "cathedral". Sometimes it's just a boathouse.  Ok, Witold, it can drift into being a vision of a beautiful home.  But what I needed today was to erect a shed and I thought I would first build some saw-horses.  There were no plans for scaffolding at all. None needed.  The man needed a wheel-barrow.  What's with the camel?