From: acmoore Date: Sun, 22 Mar 2009 21:50:19 +0000 (+0000) Subject: Adding #pastetitle command to Nopaste plugin X-Git-Tag: v1.003015~65 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FDevel-REPL.git;a=commitdiff_plain;h=da4881b1648ae6e76bf3d9387df92ef6c57a08a6 Adding #pastetitle command to Nopaste plugin This patch adds the command "#pastetitle" to Devel::REPL::Plugin::Nopaste. With this command, you can adjust the title or description that is passed to the nopaste service. This is my first contribution to Devel::REPL, so I also added myself to the contributors. git-svn-id: http://dev.catalyst.perl.org/repos/bast/trunk/Devel-REPL@5795 bd8105ee-0ff8-0310-8827-fb3f25b6796d --- diff --git a/lib/Devel/REPL.pm b/lib/Devel/REPL.pm index 1c6c3ab..b0a413f 100644 --- a/lib/Devel/REPL.pm +++ b/lib/Devel/REPL.pm @@ -404,6 +404,8 @@ Matt S Trout - mst (at) shadowcatsystems.co.uk (L >> + =back =head1 LICENSE diff --git a/lib/Devel/REPL/Plugin/Nopaste.pm b/lib/Devel/REPL/Plugin/Nopaste.pm index 283fdfb..e8baa53 100644 --- a/lib/Devel/REPL/Plugin/Nopaste.pm +++ b/lib/Devel/REPL/Plugin/Nopaste.pm @@ -21,6 +21,14 @@ has complete_session => ( }, ); +has paste_title => ( + metaclass => 'String', + is => 'rw', + isa => 'Str', + lazy => 1, + default => 'Devel::REPL session', +); + before eval => sub { my $self = shift; my $line = shift; @@ -58,11 +66,17 @@ sub command_nopaste { require App::Nopaste; return App::Nopaste->nopaste( text => $self->complete_session, - desc => "Devel::REPL session", + desc => $self->paste_title(), lang => "perl", ); } +sub command_pastetitle { + my ( $self, undef, $title ) = @_; + + $self->paste_title( $title ); +} + 1; __END__ @@ -71,9 +85,35 @@ __END__ Devel::REPL::Plugin::Nopaste - #nopaste to upload session's input and output +=head1 COMMANDS + +This module provides these commands to your Devel::REPL shell: + +=head2 #nopaste + +The C<#nopaste> sends a transcript of your session to a nopaste +site. + +=head2 #pastetitle + +The C<#pastetitle> command allows you to set the title of the paste on +the nopaste site. For example: + +C<#pastetitle example of some code> + +defaults to 'Devel::REPL session' + =head1 AUTHOR Shawn M Moore, C<< >> +=head1 CONTRIBUTORS + +=over 4 + +=item Andrew Moore - C<< >> + +=back + =cut