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

Owner: nkuitse [...]
Requestors: rafl [...]

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

Subject: Broken can()
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.
Fixed in 0.10. Thanks for reporting!

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

Please report any issues with to