Skip Menu |

This queue is for tickets about the Object-Enum CPAN distribution.

Report information
The Basics
Id: 27281
Status: resolved
Priority: 0/
Queue: Object-Enum

People
Owner: Nobody in particular
Requestors: jsailor-cpan [...] jesnetplus.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.01
  • 0.02
  • 0.03
  • 0.04
  • 0.05
  • 0.06
  • 0.070
Fixed in: (no value)



Subject: $obj->spawn doesn't work
When used on an existing Object::Enum object, spawn returns a new object blessed into package undef instead of the proper class. I've tested with Object-Enum-0.070 and perl 5.8.8 on Gentoo Linux. The following patch fixes the problem, and includes a test case: diff -rNu Object-Enum-0.070/lib/Object/Enum.pm Object-Enum-0.070.mod/lib/Object/ Enum.pm --- Object-Enum-0.070/lib/Object/Enum.pm 2006-08-28 17:36:21.000000000 -0400 +++ Object-Enum-0.070.mod/lib/Object/Enum.pm 2007-05-25 00:20:26.000000000 -0400 @@ -185,7 +185,7 @@ my $class = shift; return bless { value => $class->_default, - } => $class; + } => (ref $class or $class); } =head2 value diff -rNu Object-Enum-0.070/t/regression.t Object-Enum-0.070.mod/t/regression.t --- Object-Enum-0.070/t/regression.t 2006-08-28 17:14:50.000000000 -0400 +++ Object-Enum-0.070.mod/t/regression.t 2007-05-25 00:22:11.000000000 -0400 @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 1; +use Test::More tests => 2; use Object::Enum ( Enum => { -as => 'foo', values => ['a', 'b'] }, @@ -16,3 +16,8 @@ foo(); is($warn, undef, "no redefine warning"); } + +{ + my $obj = new Object::Enum(['foo']); + ok(eval { $obj->spawn->set_foo->is_foo }, "spawn works on objects"); +}
From: HDP [...] cpan.org
On Fri May 25 00:28:32 2007, jsailor wrote: Show quoted text
> When used on an existing Object::Enum object, spawn returns a new > object blessed into > package undef instead of the proper class.
I'm an idiot -- I fixed this in December and forgot to release, and I've been using the patched version internally. Let me review changes I've made and I'll try to release a bugfix in the next few days. Sorry for the delay.
finally fixed in 0.072