[Catalyst] Operation "eq": no method found, ... Dispatcher.pm line 377

John Napiorkowski jjn1056 at yahoo.com
Mon Jan 22 21:30:42 GMT 2007


--- Michael Reece <mreece at vinq.com> wrote:

> i am getting intermittent errors (under mod_perl;
> Catalyst version  
> 5.7003) from $c->dispatcher->uri_for_action:
> 
> Operation "eq": no method found, left argument in
> overloaded package  
> URI::_generic, right argument has no overloaded
> magic at /usr/local/ 
> lib/perl5/site_perl/5.8.8/Catalyst/Dispatcher.pm
> line 377
> 
> sub uri_for_action {
>      my ( $self, $action, $captures) = @_;
>      $captures ||= [];
>      foreach my $dispatch_type ( @{
> $self->dispatch_types } ) {
>          my $uri = $dispatch_type->uri_for_action(
> $action, $captures );
>          return( $uri eq '' ? '/' : $uri )	# line
> 377
>              if defined($uri);
>      }
>      return undef;
> }
> 
> 
> i am calling $c->dispatcher->uri_for_action like so:
> 
>      my $action =
> $c->dispatcher->get_action_by_path($path);
>      unless ($action) {
>          $c->log->error("uri_to cannot
> get_action_by_path($path)");
>          return undef;
>      }
> 
>      my @action_args = (defined $snippets) ?
> @$snippets : ();
>      my $uri =
> $c->dispatcher->uri_for_action($action,
> @action_args);
>      unless ($uri) {
>          $c->log->error("uri_to cannot find
> uri_for_action $action");
>          return undef;
>      }
> 
> 
> any ideas?
> 
> ---
> michael reece :: software engineer ::
> mreece at vinq.com

Hi,

This may not help you at all but I don't think you if
all you want is the URI for a given action that this
is the method to use.  Typically I use the $c->uri_for
and controller->action_for methods.  This works pretty
well for me.

my $uri =
$c->uri_for($c->controller(xxx)->action_for('action
private name');

If you just need the uri for an action in the current
controller and action you can make it even shorter:

my $uri = $c->uri_for($c->action);

or for a different action in the same controller:

my $uri =
$c->uri_for($c->controller->action_for('action name');

I think there are even easier ways to do this, might
want to search the archives.

Can you give me a few more details about your use case
and setup and then maybe I can understand what the
best way to solve your problem is.

--John

> 
> 
> 
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo:
> http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
>
http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
> 



 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com



More information about the Catalyst mailing list