Skip Menu |

This queue is for tickets about the MooseX-Param CPAN distribution.

Report information
The Basics
Id: 39960
Status: open
Priority: 0/
Queue: MooseX-Param

People
Owner: Nobody in particular
Requestors: dave.s.doyle [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



This is just a desire for more functionality in MooseX::Param. I like CGI::Application's param and it works just a little different. I've included a patch. Basically, I like that CGI::App::param allows you to set values via a hashref as an argument and it will process it for ya. This was the handiest change as far as I'm concerned. The other change, optional though it may be, was that when you set one value, it returns that value. CGI::App just uses that for testing and I don't necessarily see a huge value in it, but I've included it for completeness. This doesn't break any backwards compatibility as far as I can see so I thought it'd be a nice add on. Regardless of whether you choose to include this, thankee for a nifty little addon that saves me much time! And Moose. Thanks for Moose. Still getting into it but I am loving it. Cheers, Dave Doyle
Subject: MooseX-Param.pm.patch
--- Param.pm 2008-10-10 18:58:35.000000000 +0000 +++ Param.pm-ddoyle 2008-10-10 18:59:09.000000000 +0000 @@ -19,9 +19,15 @@ # if they want the list of keys ... return keys %{$self->params} if scalar @_ == 0; - # if they want to fetch a particular key ... - return $self->params->{$_[0]} if scalar @_ == 1; + # set via hashref + if ( ref $_[0] eq 'HASH' ) { + $self->params->{$_} = $_[0]->{$_} foreach keys %{$_[0]}; + return; + } + # if they want to fetch a particular key ... + return $self->params->{$_[0]} if scalar @_ == 1; + ((scalar @_ % 2) == 0) || confess "parameter assignment must be an even numbered list"; @@ -29,8 +35,9 @@ while (my ($key, $value) = each %new) { $self->params->{$key} = $value; } - - return; + + # if we're setting exactly one param, return it + return scalar @_ == 2 ? $_[1] : undef; } 1;
Subject: whoops
From: dave.s.doyle [...] gmail.com
bugger. Sorry for not titling this.
Subject: re: proposed enhancement to the param() role
I support the patch proposed here as well.
Subject: Interested in Comaint?
Dave, I don't really use this module much anymore myself, are you interested in taking over comaint? - Stevan On Fri Oct 10 15:08:32 2008, davedoyle wrote: Show quoted text
> This is just a desire for more functionality in MooseX::Param. I like > CGI::Application's param and it works just a little different. I've > included a patch. > > Basically, I like that CGI::App::param allows you to set values via a > hashref as an argument and it will process it for ya. This was the > handiest change as far as I'm concerned. > > The other change, optional though it may be, was that when you set one > value, it returns that value. CGI::App just uses that for testing and I > don't necessarily see a huge value in it, but I've included it for > completeness. > > This doesn't break any backwards compatibility as far as I can see so I > thought it'd be a nice add on. > > Regardless of whether you choose to include this, thankee for a nifty > little addon that saves me much time! > > And Moose. Thanks for Moose. Still getting into it but I am loving it. > > Cheers, > Dave Doyle
Subject: Sorry
Also, super sorry for letting this sit here for so long. And Mark, the comaint offer applies to you as well. - Stevan On Fri May 20 12:55:52 2011, STEVAN wrote: Show quoted text
> Dave, > > I don't really use this module much anymore myself, are you interested > in taking over > comaint? > > - Stevan > > On Fri Oct 10 15:08:32 2008, davedoyle wrote:
> > This is just a desire for more functionality in MooseX::Param. I
> like
> > CGI::Application's param and it works just a little different. I've > > included a patch. > > > > Basically, I like that CGI::App::param allows you to set values via
> a
> > hashref as an argument and it will process it for ya. This was the > > handiest change as far as I'm concerned. > > > > The other change, optional though it may be, was that when you set
> one
> > value, it returns that value. CGI::App just uses that for testing
> and I
> > don't necessarily see a huge value in it, but I've included it for > > completeness. > > > > This doesn't break any backwards compatibility as far as I can see
> so I
> > thought it'd be a nice add on. > > > > Regardless of whether you choose to include this, thankee for a
> nifty
> > little addon that saves me much time! > > > > And Moose. Thanks for Moose. Still getting into it but I am loving
> it.
> > > > Cheers, > > Dave Doyle
>