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=dcf83c4d6903ecbcbf51ce4a52bc33662ff1bfee;hp=db6ff7cfa0ffc51667f55147ee4a89580b6aa21c;hb=e2d0b0198529e2e06593df8ebab7a8413bc932e1;hpb=9b7bfb6ac233dca407f12db47aa8dda7c9c1d338 diff --git a/lib/Devel/REPL/Plugin/Nopaste.pm b/lib/Devel/REPL/Plugin/Nopaste.pm index db6ff7c..dcf83c4 100644 --- a/lib/Devel/REPL/Plugin/Nopaste.pm +++ b/lib/Devel/REPL/Plugin/Nopaste.pm @@ -1,9 +1,9 @@ package Devel::REPL::Plugin::Nopaste; use Devel::REPL::Plugin; -use Moose::Util::TypeConstraints; -use namespace::autoclean; +use namespace::sweep; use Scalar::Util qw(blessed); +use MooX::Types::MooseLike::Base qw(Str); sub BEFORE_PLUGIN { my $self = shift; @@ -11,28 +11,31 @@ sub BEFORE_PLUGIN { } has complete_session => ( - metaclass => 'String', is => 'rw', - isa => 'Str', + isa => Str, lazy => 1, - default => '', - handles => { - add_to_session => 'append', - }, + default => sub { '' }, ); +sub add_to_session { + my $self = shift; + my $session = $self->complete_session; + $session .= $_ for @_; + $self->complete_session($session); +} + has paste_title => ( is => 'rw', - isa => 'Str', + isa => Str, lazy => 1, - default => 'Devel::REPL session', + default => sub { 'Devel::REPL session' }, ); has 'nopaste_format' => ( is => 'rw', - isa => enum( [qw[ comment_code comment_output ]] ), + isa => sub { $_[0] =~ qr[^(?:comment_code|comment_output)$] }, lazy => 1, - default => 'comment_output', + default => sub { 'comment_output' }, ); before eval => sub {