r53974 - in /branches/upstream/libdevel-repl-perl/current: ./ lib/Devel/ lib/Devel/REPL/ lib/Devel/REPL/Meta/ lib/Devel/REPL/Plugin/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Tue Mar 9 14:04:24 UTC 2010
Author: jawnsy-guest
Date: Tue Mar 9 14:01:22 2010
New Revision: 53974
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=53974
Log:
[svn-upgrade] Integrating new upstream version, libdevel-repl-perl (1.003009)
Added:
branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Overview.pod
branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/DDC.pm
Modified:
branches/upstream/libdevel-repl-perl/current/Changes
branches/upstream/libdevel-repl-perl/current/MANIFEST
branches/upstream/libdevel-repl-perl/current/META.yml
branches/upstream/libdevel-repl-perl/current/Makefile.PL
branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL.pm
branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Meta/Plugin.pm
branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/DDS.pm
branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/Interrupt.pm
branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/LexEnv.pm
branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/ReadLineHistory.pm
branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/Timing.pm
Modified: branches/upstream/libdevel-repl-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdevel-repl-perl/current/Changes?rev=53974&op=diff
==============================================================================
--- branches/upstream/libdevel-repl-perl/current/Changes (original)
+++ branches/upstream/libdevel-repl-perl/current/Changes Tue Mar 9 14:01:22 2010
@@ -1,3 +1,7 @@
+1.3.9
+ - Fix scary Moose 0.98 box, adding a check for ->isa('Devel::REPL') in Meta/Plugin.pm
+1.3.8
+ - resolve rt.cpan#44231 SIGINT does not quit the REPL just kills the line being edited
1.3.7
- resolve rt.cpan#44919 fix deprecated use of compute_all_applicable_methods
1.3.6
Modified: branches/upstream/libdevel-repl-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdevel-repl-perl/current/MANIFEST?rev=53974&op=diff
==============================================================================
--- branches/upstream/libdevel-repl-perl/current/MANIFEST (original)
+++ branches/upstream/libdevel-repl-perl/current/MANIFEST Tue Mar 9 14:01:22 2010
@@ -15,6 +15,7 @@
lib/Devel/REPL.pm
lib/Devel/REPL/Error.pm
lib/Devel/REPL/Meta/Plugin.pm
+lib/Devel/REPL/Overview.pod
lib/Devel/REPL/Plugin.pm
lib/Devel/REPL/Plugin/B/Concise.pm
lib/Devel/REPL/Plugin/Colors.pm
@@ -26,6 +27,7 @@
lib/Devel/REPL/Plugin/CompletionDriver/LexEnv.pm
lib/Devel/REPL/Plugin/CompletionDriver/Methods.pm
lib/Devel/REPL/Plugin/CompletionDriver/Turtles.pm
+lib/Devel/REPL/Plugin/DDC.pm
lib/Devel/REPL/Plugin/DDS.pm
lib/Devel/REPL/Plugin/DumpHistory.pm
lib/Devel/REPL/Plugin/FancyPrompt.pm
Modified: branches/upstream/libdevel-repl-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdevel-repl-perl/current/META.yml?rev=53974&op=diff
==============================================================================
--- branches/upstream/libdevel-repl-perl/current/META.yml (original)
+++ branches/upstream/libdevel-repl-perl/current/META.yml Tue Mar 9 14:01:22 2010
@@ -35,4 +35,4 @@
perl: 5.8.1
resources:
license: http://dev.perl.org/licenses/
-version: 1.003007
+version: 1.003009
Modified: branches/upstream/libdevel-repl-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdevel-repl-perl/current/Makefile.PL?rev=53974&op=diff
==============================================================================
--- branches/upstream/libdevel-repl-perl/current/Makefile.PL (original)
+++ branches/upstream/libdevel-repl-perl/current/Makefile.PL Tue Mar 9 14:01:22 2010
@@ -32,9 +32,17 @@
-default => 1,
'Data::Dump::Streamer' => 0;
+feature 'DDC plugin - even better format results with Data::Dumper::Concise',
+ -default => 1,
+ 'Data::Dumper::Concise' => 0;
+
feature 'INC completion driver - tab complete module names in use and require',
-default => 0,
'File::Next' => 0;
+
+feature 'Interrupt plugin - traps SIGINT to kill long-running lines',
+ -default => 1,
+ 'Sys::SigAction' => 0;
feature 'Keywords completion driver - tab complete Perl keywords and operators',
-default => 0,
Modified: branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL.pm?rev=53974&op=diff
==============================================================================
--- branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL.pm (original)
+++ branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL.pm Tue Mar 9 14:01:22 2010
@@ -5,7 +5,7 @@
use namespace::clean -except => [ 'meta' ];
use 5.008001; # backwards compat, doesn't warn like 5.8.1
-our $VERSION = '1.003007'; # 1.3.7
+our $VERSION = '1.003009'; # 1.3.9
with 'MooseX::Object::Pluggable';
@@ -406,6 +406,10 @@
=item Andrew Moore - C<< <amoore at cpan.org> >>
+=item Norbert Buchmuller C<< <norbi at nix.hu> >>
+
+=item Dave Houston C<< <dhouston at cpan.org> >>
+
=back
=head1 LICENSE
Modified: branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Meta/Plugin.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Meta/Plugin.pm?rev=53974&op=diff
==============================================================================
--- branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Meta/Plugin.pm (original)
+++ branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Meta/Plugin.pm Tue Mar 9 14:01:22 2010
@@ -6,6 +6,7 @@
before 'apply' => sub {
my ($self, $other) = @_;
+ return unless $other->isa('Devel::REPL');
if (my $pre = $self->get_method('BEFORE_PLUGIN')) {
$pre->body->($other, $self);
}
@@ -13,6 +14,7 @@
after 'apply' => sub {
my ($self, $other) = @_;
+ return unless $other->isa('Devel::REPL');
if (my $pre = $self->get_method('AFTER_PLUGIN')) {
$pre->body->($other, $self);
}
Added: branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Overview.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Overview.pod?rev=53974&op=file
==============================================================================
--- branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Overview.pod (added)
+++ branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Overview.pod Tue Mar 9 14:01:22 2010
@@ -1,0 +1,263 @@
+=head1 NAME
+
+Devel::REPL::Overview - overview of Devel::REPL.
+
+=head1 DESCRIPTION
+
+=head2 What is a console? How it can assist you?
+
+ Most modern languages have consoles. Console is an interactive tool
+that evaluates your input while you type it.
+It gives you several advantages:
+
+=over 2
+
+=item *
+
+Quickly test some thought or tricky expression
+
+=item *
+
+Run some code bigger than one line without a temporary file
+
+=item *
+
+Play around with libraries and modules
+
+=item *
+
+You can even call a console in your script and play around in script's context
+
+=back
+
+
+For Ruby it would be irb, for Python is... python byitself and for perl...
+and there was nothing for perl (except that ugly perl -d -e "" and several
+failed projects) until Devel::REPL was written by Matt S Trout (a.k.a. mst)
+from ShadowCatSystems L<http://www.shadowcatsystems.co.uk>.
+
+
+=head2 Devel::REPL - the Perl console
+
+
+REPL stands for Read, Evaluate, Print, Loop.
+Lets install and try it.
+
+ $ cpan Devel::REPL
+
+After installation you have a lot of new modules,
+but the most interesting things are:
+
+=over 2
+
+=item *
+
+Devel::REPL
+ A top level module.
+
+=item *
+
+re.pl
+ Wrapper script, running console.
+
+=back
+
+And a bunch of plugins (I'll describe them later).
+In command line type:
+
+ $ re.pl
+
+If everything is ok you'll see a prompt (underlined $).
+That's it. You can start typing expressions.
+
+An example session:
+
+ $ sub factorial {
+
+ > my $number = shift;
+
+ > return $number > 1 ? $number * factorial($number-1) : $number;
+
+ > }
+
+ $ factorial 1 # by the way, comments are allowed
+
+ 1 # our return value
+
+ $ factorial 5
+
+ 120
+
+ $ [1,2,3,4,5,6,7]
+ $ARRAY1 = [
+ 1,
+ 2,
+ 3, # return values are printed with Data::Dumper::Streamer.
+ 4, # See Plugins section
+ 5,
+ 6,
+ 7
+ ];
+
+ $ {apple=>1,fruit=>'apple',cart=>['apple','banana']}
+ $HASH1 = {
+ apple => 1,
+ cart => [
+ 'apple',
+ 'banana'
+ ],
+ fruit => 'apple'
+ };
+
+ $ package MyPackage; # create a package
+
+ $ sub say_hi { # define a sub
+
+ > print "Hi!\n";
+
+ > } # statement is evaluated only after we've finished typing block.
+ # See Plugins section.
+ > __PACKAGE__
+ MyPackage
+ > package main;
+
+ > __PACKAGE_
+ main
+ > MyPackage->say_hi
+ Hi!
+ 1
+ $
+
+
+=head2 Control files a.k.a. I don't want to type it every time
+
+Devel::REPL has control files feature. Control files are
+evaluated on session start in the same way as you would
+type them manually in console.
+
+Default control file is located at `$HOME/.re.pl/repl.rc` .
+
+You can store there any statements you would normally type in.
+
+I.e. my `$HOME/.re.pl/repl.rc` has next lines:
+
+ use feature 'say'; # to don't write \n all the time
+
+ use Data::Dumper;
+
+ # pretty print data structures
+ sub pp { print Data::Dumper->Dump([@_]) }
+
+You can have multiple control files and they can be anywhere in the
+file system. To make re.pl use some rc-file other than repl.rc
+call it like this:
+
+ $ re.pl --rcfile /path/to/your/rc.file
+
+If your rc-file is in `$HOME/.re.pl` directory, you can omit path:
+
+ $ re.pl --rcfile rc.file
+
+If you have rc-file with the same name in current directory
+and you don't want to type path, you can:
+
+ $ re.pl --rcfile ./rc.file
+
+=head2 I want it to bark, fly, jump and swim! or Plugins
+
+Plugins extend functionality and change behavor of Devel::REPL.
+Bundled plugins are:
+
+=over 2
+
+=item *
+
+Devel::REPL::Plugin::History
+ No comments. Simply history.
+
+=item *
+
+Devel::REPL::Plugin::!LexEnv
+ Provides a lexical environment for the Devel::REPL.
+
+=item *
+
+Devel::REPL::Plugin::DDS
+ Formats return values with Data::Dump::Streamer module.
+
+=item *
+
+Devel::REPL::Plugin::Packages
+ Keeps track of which package your're in.
+
+=item *
+
+Devel::REPL::Plugin::Commands
+ Generic command creation plugin using injected functions.
+
+=item *
+
+Devel::REPL::Plugin::MultiLine::PPI
+ Makes Devel::REPL read your input until your block
+ is finished. What does this means: you can type a part of a block
+ on one line and second part on another:
+
+ $ sub mysub {
+
+ > print "Hello, World!\n"; ## notice prompt change
+
+ > }
+
+ $ mysub
+ Hello, World!
+ 1
+ $
+
+ but this *doesn't* mean you can print sub name or identifier
+ on several lines. Don't do that! It won't work.
+
+
+=back
+
+There are lots of contributed plugins you can find at CPAN.
+
+=head1 Profiles
+
+If plugins change and extend functionality of Devel::REPL, profiles
+are changing your environment (loaded plugins, constants, subs and etc.).
+
+There's only one bundled profile called `Devel::REPL::Profile::Default`, lets
+take a look at it:
+
+ package Devel::REPL::Profile::Default;
+
+ use Moose; ### advanced OOP system for Perl
+
+ ### keep those exports/imports out of our namespace
+ use namespace::clean -except => [ 'meta' ];
+
+ with 'Devel::REPL::Profile'; ## seem perldoc Muse
+
+ sub plugins { ### plugins we want to be loaded
+ qw(History LexEnv DDS Packages Commands MultiLine::PPI);
+ }
+
+ ### the only required sub for profile,
+ ### it is called on profile activation
+ sub apply_profile {
+ my ($self, $repl) = @_;
+ ### $self - no comments, $repl - current instance of Devel::REPL
+
+ $repl->load_plugin($_) for $self->plugins; ### load our plugins
+ }
+
+ 1;
+
+At the moment there are no profiles on CPAN. Mostly you'll use control files.
+To enable some profile use --profile switch:
+
+ $ re.pl --profile SomeProfile
+
+=head1 See Also
+
+L<Devel::REPL>, L<Devel::REPL::Plugin>, L<Devel::REPL::Profile>
Added: branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/DDC.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/DDC.pm?rev=53974&op=file
==============================================================================
--- branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/DDC.pm (added)
+++ branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/DDC.pm Tue Mar 9 14:01:22 2010
@@ -1,0 +1,50 @@
+package Devel::REPL::Plugin::DDC;
+
+use Devel::REPL::Plugin;
+use Data::Dumper::Concise ();
+
+around 'format_result' => sub {
+ my $orig = shift;
+ my $self = shift;
+ my $to_dump = (@_ > 1) ? [@_] : $_[0];
+ my $out;
+ if (ref $to_dump) {
+ if (overload::Method($to_dump, '""')) {
+ $out = "$to_dump";
+ } else {
+ $out = Data::Dumper::Concise::Dumper($to_dump);
+ }
+ } else {
+ $out = $to_dump;
+ }
+ $self->$orig($out);
+};
+
+1;
+
+__END__
+
+=head1 NAME
+
+Devel::REPL::Plugin::DDC - Format results with Data::Dumper::Concise
+
+=head1 SYNOPSIS
+
+ # in your re.pl file:
+ use Devel::REPL;
+ my $repl = Devel::REPL->new;
+ $repl->load_plugin('DDS');
+ $repl->run;
+
+ # after you run re.pl:
+ $ map $_*2, ( 1,2,3 )
+[
+ 2,
+ 4,
+ 6
+];
+
+ $
+
+=cut
+
Modified: branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/DDS.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/DDS.pm?rev=53974&op=diff
==============================================================================
--- branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/DDS.pm (original)
+++ branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/DDS.pm Tue Mar 9 14:01:22 2010
@@ -31,5 +31,23 @@
Devel::REPL::Plugin::DDS - Format results with Data::Dump::Streamer
+=head1 SYNOPSIS
+
+ # in your re.pl file:
+ use Devel::REPL;
+ my $repl = Devel::REPL->new;
+ $repl->load_plugin('DDS');
+ $repl->run;
+
+ # after you run re.pl:
+ $ map $_*2, ( 1,2,3 )
+ $ARRAY1 = [
+ 2,
+ 4,
+ 6
+ ];
+
+ $
+
=cut
Modified: branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/Interrupt.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/Interrupt.pm?rev=53974&op=diff
==============================================================================
--- branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/Interrupt.pm (original)
+++ branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/Interrupt.pm Tue Mar 9 14:01:22 2010
@@ -1,17 +1,44 @@
package Devel::REPL::Plugin::Interrupt;
use Devel::REPL::Plugin;
+use Sys::SigAction qw(set_sig_handler);
use namespace::clean -except => [ 'meta' ];
-around 'eval' => sub {
- my $orig = shift;
- my ($self, $line) = @_;
+around 'run' => sub {
+ my ($orig, $self) = (shift, shift);
- local $SIG{INT} = sub {
+ local $SIG{INT} = 'IGNORE';
+
+ return $self->$orig(@_);
+};
+
+around 'run_once' => sub {
+ my ($orig, $self) = (shift, shift);
+
+ # We have to use Sys::SigAction: Perl 5.8+ has safe signal handling by
+ # default, and Term::ReadLine::Gnu restarts the interrupted system calls.
+ # The result is that the signal handler is not fired until you hit Enter.
+ my $sig_action = set_sig_handler INT => sub {
die "Interrupted.\n";
};
- return $self->$orig($line);
+ return $self->$orig(@_);
+};
+
+around 'read' => sub {
+ my ($orig, $self) = (shift, shift);
+
+ # here SIGINT is caught and only kills the line being edited
+ while (1) {
+ my $line = eval { $self->$orig(@_) };
+ return $line unless $@;
+
+ die unless $@ =~ /^Interrupted\./;
+
+ # (Term::ReadLine::Gnu kills the line by default, but needs a LF -
+ # maybe I missed something?)
+ print "\n";
+ }
};
1;
@@ -22,9 +49,15 @@
Devel::REPL::Plugin::Interrupt - traps SIGINT to kill long-running lines
+=head1 DESCRIPTION
+
+By default L<Devel::REPL> exits on SIGINT (usually Ctrl-C). If you load this
+module, SIGINT will be trapped and used to kill long-running commands
+(statements) and also to kill the line being edited (like eg. BASH do). (You
+can still use Ctrl-D to exit.)
+
=head1 AUTHOR
Shawn M Moore, C<< <sartak at gmail dot com> >>
=cut
-
Modified: branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/LexEnv.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/LexEnv.pm?rev=53974&op=diff
==============================================================================
--- branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/LexEnv.pm (original)
+++ branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/LexEnv.pm Tue Mar 9 14:01:22 2010
@@ -68,5 +68,24 @@
Devel::REPL::Plugin::LexEnv - Provide a lexical environment for the REPL
+=head1 SYNOPSIS
+
+ # in your re.pl file:
+ use Devel::REPL;
+ my $repl = Devel::REPL->new;
+ $repl->load_plugin('LexEnv');
+
+ $repl->lexical_environment->do(<<'CODEZ');
+ use FindBin;
+ use lib "$FindBin::Bin/../lib";
+ use MyApp::Schema;
+ my $s = MyApp::Schema->connect('dbi:Pg:dbname=foo','broseph','elided');
+ CODEZ
+
+ $repl->run;
+
+ # after you run re.pl:
+ $ warn $s->resultset('User')->first->first_name # <-- note that $s works
+
=cut
Modified: branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/ReadLineHistory.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/ReadLineHistory.pm?rev=53974&op=diff
==============================================================================
--- branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/ReadLineHistory.pm (original)
+++ branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/ReadLineHistory.pm Tue Mar 9 14:01:22 2010
@@ -1,6 +1,6 @@
# First cut at using the readline history directly rather than reimplementing
# it. It does save history but it's a little crappy; still playing with it ;)
-#
+#
# epitaph, 22nd April 2007
package Devel::REPL::Plugin::ReadLineHistory;
Modified: branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/Timing.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/Timing.pm?rev=53974&op=diff
==============================================================================
--- branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/Timing.pm (original)
+++ branches/upstream/libdevel-repl-perl/current/lib/Devel/REPL/Plugin/Timing.pm Tue Mar 9 14:01:22 2010
@@ -30,6 +30,20 @@
Devel::REPL::Plugin::Timing - display execution times
+=head1 SYNOPSIS
+
+ # in your re.pl file:
+ use Devel::REPL;
+ my $repl = Devel::REPL->new;
+ $repl->load_plugin('Timing');
+
+ # after you run re.pl:
+ $ sum map $_*100, 1..100000;
+ Took 0.0830280780792236 seconds.
+ 500005000000
+
+ $
+
=head1 AUTHOR
Shawn M Moore, C<< <sartak at gmail dot com> >>
More information about the Pkg-perl-cvs-commits
mailing list