Skip Menu |

This queue is for tickets about the Safe-Isa CPAN distribution.

Report information
The Basics
Id: 100866
Status: resolved
Priority: 0/
Queue: Safe-Isa

People
Owner: ether [...] cpan.org
Requestors: ether [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: 1.000010



Subject: does/DOES fallback
06:07 < Mithaldu> perl -e 'use Safe::Isa; my $c = {}; $c->$_does( q[moo] ); bless $c, q[ANYTHINGMAYBEEVENANANIME]; $c->$_does( q[moo] )' 06:07 < Mithaldu> Can't locate object method "does" via package "ANYTHINGMAYBEEVENANANIME" at C:/Perl/site/lib/Safe/Isa.pm line 15. 10:58 < xdg> mst, ether: how about if does/DOES fall back to isa unless $obj->can(does|DOES)? Then randomly blessed garbage can just fail isa. 11:00 < ether> makes sense to me I'll implement if the mst gods give their blessing.
Also, having a fallback to 'isa' means that $_DOES works on v5.8.
On Thu Dec 11 14:01:10 2014, ETHER wrote: Show quoted text
> 06:07 < Mithaldu> perl -e 'use Safe::Isa; my $c = {}; $c->$_does( > q[moo] ); bless $c, q[ANYTHINGMAYBEEVENANANIME]; $c->$_does( q[moo] )' > 06:07 < Mithaldu> Can't locate object method "does" via package > "ANYTHINGMAYBEEVENANANIME" at C:/Perl/site/lib/Safe/Isa.pm line 15. > 10:58 < xdg> mst, ether: how about if does/DOES fall back to isa > unless $obj->can(does|DOES)? Then randomly blessed garbage can just > fail isa. > 11:00 < ether> makes sense to me > > > I'll implement if the mst gods give their blessing.
Given Moo/Moose's does() don't, I think what we need to do is add a $_call_if_method that does a blessed -and- an ->can check, and then implement $_does in terms of that. $_DOES can be special cased to do ->DOES or ->isa.
It looks like this was implemented incorrectly in de8d80ef665baf5e89e0574604fd63e091f73723 (1.000006). Rather than having does be a noop and DOES fall back to ->isa if they don't exist, all case variants of does fall back to isa.
Fully fixed in 1.000010