[Omaha.pm] Catalyst Action @args tip

Jay Hannah jhannah at omnihotels.com
Wed Aug 5 11:48:50 PDT 2009


FYI, 

 

Catalyst parses URL arguments for you. So if someone hits the URL
"/histPhoenix/blah" you can say 

 

sub histPhoenix : Local {

   my ($self, $c, @args) = @_;

 

and $args[0] will be 'blah'.

 

 

 

So instead of writing this:

 

sub histPhoenix : Local {

   my ($self, $c) = @_;

   my $uri=${$c->req->uri};

   if ( my ($type)=( $uri =~ /histPhoenix\/(.+?)$/i ) ) {

 

 

You can just do this:

 

sub histPhoenix : Local {

   my ($self, $c, $type) = @_;

 

 

$0.02,

 

j

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/omaha-pm/attachments/20090805/190ae4af/attachment.html>


More information about the Omaha-pm mailing list