images | audio | feed | contact

pullingshots

Devel::REPL

I've been programming Perl for years and started using Devel:REPL recently, but I didn't really appreciate it until now. I'm creating a site for my son to post the comics that he draws using Dancer. The combination of Dancer and Devel::REPL is really quite nice. Simply running

$ re.pl
$ use Dancer

from within your Dancer App directory will import everything you need to start playing around with your Dancer App, so this:

$ template 'index'

will display the generated html of your index template, and this:

$ template 'index', { page_title => 'Enjoy!' }

will pass the template options.

Plus, Devel::REPL isn't just another interactive mode, its got plugins! -- colours, auto-completion, pretty printing data structures... Here's my ~/.re.pl/repl.rc

use Modern::Perl;

use Term::ANSIColor;

no warnings 'redefine';

my @plugins = (
    'ReadLineHistory', # history saved across sessions
    'Colors', # colorize return value and errors
    'Refresh', # refresh before every eval
    'Interrupt', # improve handling of ^C
    'OutputCache', # access previous results
    'Nopaste', # paste session with #nopaste
    'DDS', # format output with Data::Dumper::Concise
    'PPI', # PPI dumping of Perl code
    'MultiLine::PPI', # allow multiple lines
    'Completion',
    'CompletionDriver::Keywords', # substr, while, etc
    'CompletionDriver::LexEnv', # current environment
    'CompletionDriver::Globals', # global variables
    'CompletionDriver::INC', # loading new modules
    'CompletionDriver::Methods', # class method completion
    'CompletionDriver::Turtles', # turtle command completion
);
$_REPL->load_plugin($_) for @plugins;
$_REPL->normal_color('blue');
$Devel::REPL::Plugin::Packages::PKG_SAVE = 'main';

END {
 print "\n";
}

posted at 2011-08-27T17:18:30 by baerg