Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 46614
Status: resolved
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: TIMB [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 2.1900-TRIAL



Subject: Error when delegated-to method not found could be improved
For example: Can't locate object method "schema" via package "TigerLead::Schema::PPC_YSM" at /home/tim/trunk/perl/cpan/lib/perl5/Moose/Meta/Method/Delegation.pm line 91 doesn't indicate the file and line number of the method call itself. The name of the attribute handling the delegation would also be handy.
On Tue Jun 02 08:08:53 2009, TIMB wrote: Show quoted text
> For example: > > Can't locate object method "schema" via package > "TigerLead::Schema::PPC_YSM" at > /home/tim/trunk/perl/cpan/lib/perl5/Moose/Meta/Method/Delegation.pm > line 91 > > doesn't indicate the file and line number of the method call itself. > The name of the attribute handling the delegation would also be handy.
I think to do something intelligent here we'd have to call $object->attr->can('method') before actually calling the delegation method, _every time_. Is the speed hit worth it? I don't know (haven't benchmarked either).
CC: TIMB [...] cpan.org
Subject: Re: [rt.cpan.org #46614] Error when delegated-to method not found could be improved
Date: Sun, 13 Sep 2009 11:08:20 +0100
To: DROLSKY via RT <bug-Moose [...] rt.cpan.org>
From: Tim Bunce <Tim.Bunce [...] pobox.com>
On Sat, Sep 12, 2009 at 06:55:55PM -0400, DROLSKY via RT wrote: Show quoted text
> > Can't locate object method "schema" via package > > "TigerLead::Schema::PPC_YSM" at > > /home/tim/trunk/perl/cpan/lib/perl5/Moose/Meta/Method/Delegation.pm > > line 91 > > > > doesn't indicate the file and line number of the method call itself. > > The name of the attribute handling the delegation would also be handy.
> > I think to do something intelligent here we'd have to call > $object->attr->can('method') before actually calling the delegation > method, _every time_. > > Is the speed hit worth it? I don't know (haven't benchmarked either).
Umm. Or perhaps wrap in an eval { } and check for /^Can't locate object method "$method"/ and add in the extra info only if that matches. Eval { } is very cheap. Tim.
I had an idea to memoize the delegation method lookup, but unfortunately we can't because the attribute can be a subclass in some instances. Doh.
On Sun Sep 13 06:33:12 2009, Tim.Bunce@pobox.com wrote: Show quoted text
> On Sat, Sep 12, 2009 at 06:55:55PM -0400, DROLSKY via RT wrote:
> > > Can't locate object method "schema" via package > > > "TigerLead::Schema::PPC_YSM" at > > > /home/tim/trunk/perl/cpan/lib/perl5/Moose/Meta/Method/Delegation.pm > > > line 91 > > > > > > doesn't indicate the file and line number of the method call itself. > > > The name of the attribute handling the delegation would also be handy.
> > > > I think to do something intelligent here we'd have to call > > $object->attr->can('method') before actually calling the delegation > > method, _every time_. > > > > Is the speed hit worth it? I don't know (haven't benchmarked either).
> > Umm. Or perhaps wrap in an eval { } and check for /^Can't locate object > method "$method"/ and add in the extra info only if that matches. > Eval { } is very cheap.
I was just looking at this again. While eval is a reasonable suggestion, some code also acts differently under eval, which is a problem since we really want to make sure delegation acts as identically to $self->delegate->method as possible.
On 2016-09-11 13:45:20, DROLSKY wrote: Show quoted text
This has been merged and released as 2.1900-TRIAL.