| App-REPL documentation | Contained in the App-REPL distribution. |
App::REPL - A container for functions for the iperl program
Version 0.01
This module contains functions that the iperl program automatically imports into any package it enters, for interactive convenience.
Please see the README for general information.
Print arguments with Data::Dumper::Dumper
Print arguments with print
Return a hashref containing the (stored -- not current) lexical environment.
Return a reference to the value of the previous evaluation --
that is, a reference to whatever irepl printed after the last
Perl you evaluated. This function will probably evolve to
take an argument $n, to return the $n'th previous result.
$value)With no arguments, bump $REPL::DEBUG. With an argument, set
$REPL::DEBUG to that. This is for debugging iperl itself;
currently at 1 it shows eval'd code, and at 2 it dumps the PPI
document corresponding to entered code.
With no arguments, print a brief message. With an argument,
either print corresponding help or -- in the case of 'commands',
currently the only optional argument -- call perldoc
appropriately.
Julian Fondren, <ayrnieu@cpan.org>
Does not reliably report errors in eval'd code.
Does not try hard enough to collect a return value from eval'd code.
Makes probably dangerous use of PPI.
Please report any bugs or feature requests to
bug-app-repl@rt.cpan.org, or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=App-REPL.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
A subversion repository with anonymous checkout exists at http://OpenSVN.csie.org/app_repl , and you can also browse the repository from that URL with a web browser.
Copyright 2007 Julian Fondren, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| App-REPL documentation | Contained in the App-REPL distribution. |
package App::REPL; use warnings; use strict; use Data::Dumper; use PadWalker 'peek_my'; use Term::ANSIColor ':constants'; $Term::ANSIColor::AUTORESET = 1; require Exporter; use vars qw(@ISA @EXPORT $VERSION); $VERSION = '0.012'; @ISA = qw(Exporter); @EXPORT = qw(x p env ret rdebug help); # ---------------------------------------------------------------------- sub x { print Dumper @_ } sub p { print @_, "\n" } sub env { peek_my(1) } sub ret { $App::REPL::ret } sub rdebug { if (@_) { $App::REPL::DEBUG = shift } else { $App::REPL::DEBUG++ } print YELLOW "Debug level set to $App::REPL::DEBUG\n" } sub help { if (@_ and shift eq 'commands') { system perldoc => 'App::REPL' } else { print YELLOW <<EOH; Auto-imported commands (from App::REPL): x p env ret rdebug help See also: C<help 'commands'> EOH } } 1; __END__ # ----------------------------------------------------------------------