Skip Menu |
 

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

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

People
Owner: nkuitse [...] cpan.org
Requestors: dha [...] panix.com
Cc:
AdminCc:

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



Subject: t/02get-and-set.t fails 2nd test due to isa() weirdness
Download (untitled) / with headers
text/plain 903b
The second test compares an empty Hash::AsObject object to an empty anonymous hash. Unfortunately, the line C<return eval { ref $thing && $thing->isa('UNIVERSAL') } ? 1 : 0;> uses Hash::AsObject::isa rather than UNIVERSAL::isa, as it clearly hasn't read the docs for Hash::AsObject. As a result, Hash::AsObject::isa causes the object to no longer be empty - it now contains an entry under 'isa' (Like so: DB<19> x $this 0 Hash::AsObject=HASH(0x18d51a4) 'isa' => 'UNIVERSAL' ) which it then compares to the empty anonymous hash ref ( 0 HASH(0x1923c14) empty hash ) This clearly will not compare positively. I'd try to work out a patch, but I'm not quite sure how you would like this to be resolved. :-/ FYI, This is perl, v5.8.7 built for darwin-2level 8.2.0 Darwin Kernel Version 8.2.0: Fri Jun 24 17:46:54 PDT 2005; root:xnu-792.2.4.obj~3/RELEASE_PPC Power Macintosh powerpc
From: dmagnuszewski { AT } mandtbank (D O T) com
Has there been any progress made on resolving this bug? I'm stuck in the same spot. Thanks. On Sat Oct 08 22:33:54 2005, guest wrote: Show quoted text
> The second test compares an empty Hash::AsObject object to an empty > anonymous hash. > > Unfortunately, the line > > C<return eval { ref $thing && $thing->isa('UNIVERSAL') } ? 1 : 0;> > > uses Hash::AsObject::isa rather than UNIVERSAL::isa, as it clearly > hasn't read the docs for Hash::AsObject. > > As a result, Hash::AsObject::isa causes the object to no longer be > empty - it now contains an entry under 'isa' > > (Like so: > > DB<19> x $this > 0 Hash::AsObject=HASH(0x18d51a4) > 'isa' => 'UNIVERSAL' > > ) > > which it then compares to the empty anonymous hash ref > > ( > 0 HASH(0x1923c14) > empty hash > ) > > This clearly will not compare positively. > > I'd try to work out a patch, but I'm not quite sure how you would like > this to be resolved. :-/ > > FYI, > > This is perl, v5.8.7 built for darwin-2level > > 8.2.0 Darwin Kernel Version 8.2.0: Fri Jun 24 17:46:54 PDT 2005; > root:xnu-792.2.4.obj~3/RELEASE_PPC Power Macintosh powerpc
From: nkuitse [...] cpan.org
Download (untitled) / with headers
text/plain 523b
On Sat Oct 08 22:33:54 2005, guest wrote: Show quoted text
> The second test compares an empty Hash::AsObject object to an empty > anonymous hash. > > Unfortunately, the line > > C<return eval { ref $thing && $thing->isa('UNIVERSAL') } ? 1 : 0;> > > uses Hash::AsObject::isa rather than UNIVERSAL::isa, as it clearly > hasn't read the docs for Hash::AsObject.
Sorry, I forgot about this bug report. The strange thing is, there isn't any such line in t/02get-and-set.t or in any of the other test files. Are you running version 0.05?
Download (untitled) / with headers
text/plain 951b
On Mon Feb 20 18:37:32 2006, NKUITSE wrote: Show quoted text
> On Sat Oct 08 22:33:54 2005, guest wrote: > The strange thing is, there isn't any such line in t/02get-and-set.t > or in any of the other test > files. Are you running version 0.05?
That comes from within Test::Builder. Today's advice about ->can and ->isa is that the user is to always use the method form in preference to UNIVERSAL::isa(...) and UNIVERSAL::can(...) (imported or used directly). This advice enables objects to provide their own ->isa() and ->can() which is expected when there is an AUTOLOAD. That is, all objects with AUTOLOAD are expected to also provide ->isa()/->can() methods and all object users are expected to treat the functional isa()/can() as deprecated. This puts Hash::AsObject in a pickle since it promotes the deprecated form. Users of this module can ignore this failing test. It's a problem with Hash::AsObject incorrectly responding to a $obj->isa('UNIVERSAL') test.
Download (untitled) / with headers
text/plain 272b
I believe this is fixed in Hash-AsObject 0.07, which has just been uploaded to CPAN. I'm not entirely sure it's working now, though -- or that the test suite adequately exercises isa() and other special methods -- so please re-open the ticket if it's still misbehaving.


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.