Skip Menu |

This queue is for tickets about the App-Nopaste CPAN distribution.

Report information
The Basics
Id: 55925
Status: resolved
Priority: 0/
Queue: App-Nopaste

People
Owner: Nobody in particular
Requestors: jmmills [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.18
  • 0.19
Fixed in: (no value)



Subject: flexible nopaste() arguments...
I thought I posted this patch before but I can't find any record of it in RT so if this is a repeat just yell at me and I'll shut-up. I've recently found my self subclassing App::Nopaste::Command in conjunction with building in house service classes that require additional configurable command line/config file parameters. This patch allows a service class to pick up on new command line (configfile) options from a sub-classed A:N::Command class via slurping in attributes from the command class. Thanks, - Jason
Subject: args_from_meta_attr-0.19.patch
--- lib/App/Nopaste/Command.pm.orig 2010-01-14 20:11:25.371820437 -0800 +++ lib/App/Nopaste/Command.pm 2010-01-15 12:12:16.341450366 -0800 @@ -71,17 +71,13 @@ sub run { my $self = shift; - my $text = $self->read_text; - - my %args = ( - text => $text, - desc => $self->desc, - nick => $self->nick, - lang => $self->lang, - chan => $self->chan, - services => $self->services, - ); + my %args = map { + $_->name => $_->get_value($self) + } $self->meta->get_all_attributes; + + $args{text} ||= $self->read_text; + $args{error_handler} = $args{warn_handler} = sub { } if $self->quiet;
Here is an updated version of the patch for the 0.21 release. On Thu Mar 25 05:17:47 2010, JMMILLS wrote: Show quoted text
> I thought I posted this patch before but I can't find any record of it
in Show quoted text
> RT so if this is a repeat just yell at me and I'll shut-up. > > I've recently found my self subclassing App::Nopaste::Command in > conjunction with building in house service classes that require > additional configurable command line/config file parameters. > > This patch allows a service class to pick up on new command line > (configfile) options from a sub-classed A:N::Command class via
slurping Show quoted text
> in attributes from the command class. > > Thanks, > - Jason
Subject: args_from_meta_attr-0.21.patch
--- lib/App/Nopaste/Command.pm.orig 2010-05-04 01:27:09.686189588 -0700 +++ lib/App/Nopaste/Command.pm 2010-05-04 01:29:03.612189627 -0700 @@ -95,17 +95,11 @@ exit 0; } - my $text = $self->read_text; - - my %args = ( - text => $text, - desc => $self->desc, - nick => $self->nick, - lang => $self->lang, - chan => $self->chan, - services => $self->services, - private => $self->private, - ); + my %args = map { + $_->name => $_->get_value($self) + } $self->meta->get_all_attributes; + + $args{text} ||= $self->read_text; $args{error_handler} = $args{warn_handler} = sub { } if $self->quiet;
Hi Jason, Sorry it took so long. I merged your pull request in github and it'll be released in 0.29. Shawn