NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Ohh, Moose Golf! (Score:1)
So, in the interest of TIMTOWTDI, here is another approach that uses coercion to extract the params list from the controller object.
And then your code would look like this ...
Now, passing a controller where your supposed to pass params does seem a little odd, so perhaps this isnt the best example. However you could just as easily pass in the
$controller->allowed_query_paramsand do the coercion on theHashRef[HashRef]type (or better yet, use MooseX::Types::Structured to define a stricter Dictionary type).One of the benefits I see with using types and coercion is that since types are global, this promotes cross cutting re-use since now any class that needs a list of PIPs::QueryParams::Param objects and happens to have easy access to a $controller object can use this coercion.
Anyway, glad your enjoying the Moose :)
- Stevan
Reply to This