Skip Menu |
 

This queue is for tickets about the Hash-AsObject CPAN distribution.

Report information
The Basics
Id: 32141
Status: resolved
Priority: 0/
Queue: Hash-AsObject

People
Owner: nkuitse [...] cpan.org
Requestors: rafl [...] debian.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.09
Fixed in: (no value)



Subject: Broken can()
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Type: text/plain
Charset: utf8
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 793
Download (untitled) / with headers
text/plain 793b
The can() implementation currently just returns 1. According to the UNIVERSAL documentation this is wrong as the can method should return a code reference to the method that would be invoked if you would have invoked a method with the name given as the second argument. The following code, which could be taken as a testcase, is ought to work: my $o = Hash::AsObject->new({ a => 42 }); die unless $o->can('a')->($o) == 42; but it currently doesn't as perl will try to dereference a plan scalar holding '1', which is not going to work. It'll throw an exception instead. A possible solution is to generate the accessor/mutator methods in can as well as in AUTOLOAD and return a reference to the newly created sub from can. If you want me to I can provide a fix and tests for this issue.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Charset: utf8
Message-Id: <rt-3.6.HEAD-4875-1200860448-702.32141-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 36
Fixed in 0.10. Thanks for reporting!


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.