List Info

Thread: Operation "eq": no method found, ... Dispatcher.pm line 377




Operation "eq": no method found, ... Dispatcher.pm line 377
user name
2007-01-22 13:16:53
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 :: mreecevinq.com



_______________________________________________
List: Catalystlists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalystlists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/

Re: Operation "eq": no method found, ... Dispatcher.pm line 377
user name
2007-01-22 15:30:42
--- Michael Reece <mreecevinq.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 ::
> mreecevinq.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: Catalystlists.rawmode.org
> Listinfo:
> ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
>
http://www.mail-
archive.com/catalystlists.rawmode.org/
> Dev site: http://dev.catalyst.per
l.org/
> 



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

_______________________________________________
List: Catalystlists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalystlists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )