X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FDevel-REPL.git;a=blobdiff_plain;f=lib%2FDevel%2FREPL%2FPlugin%2FNopaste.pm;h=bff581aebbb6077778816894055f919789f623e2;hp=19e30ae976153a32f4c77ddae10cfb857f2e8aaa;hb=9c4fddb350dfc5c966414fa8ce43afce323573a8;hpb=24cc824faa918e5ac9f61b122d7e22b1fc47219d diff --git a/lib/Devel/REPL/Plugin/Nopaste.pm b/lib/Devel/REPL/Plugin/Nopaste.pm index 19e30ae..bff581a 100644 --- a/lib/Devel/REPL/Plugin/Nopaste.pm +++ b/lib/Devel/REPL/Plugin/Nopaste.pm @@ -1,10 +1,13 @@ package Devel::REPL::Plugin::Nopaste; -use Moose::Role; +use Devel::REPL::Plugin; use MooseX::AttributeHelpers; use namespace::clean -except => [ 'meta' ]; -with 'Devel::REPL::Plugin::Turtles'; +sub BEFORE_PLUGIN { + my $self = shift; + $self->load_plugin('Turtles'); +} has complete_session => ( metaclass => 'String', @@ -16,21 +19,24 @@ has complete_session => ( }, ); -around eval => sub { - my $orig = shift; +before eval => sub { my $self = shift; my $line = shift; - my @ret = $orig->($self, $line, @_); - # prepend each line with # $line =~ s/^/# /mg; - my $step = $line . "\n" - . join("\n", @ret) - . "\n\n"; + $self->add_to_session($line . "\n"); +}; + +around eval => sub { + my $orig = shift; + my $self = shift; + my $line = shift; + + my @ret = $orig->($self, $line, @_); - $self->add_to_session($step); + $self->add_to_session(join("\n", @ret) . "\n\n"); return @ret; }; @@ -48,3 +54,15 @@ sub command_nopaste { 1; +__END__ + +=head1 NAME + +Devel::REPL::Plugin::Nopaste - #nopaste to upload session's input and output + +=head1 AUTHOR + +Shawn M Moore, C<< >> + +=cut +