Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Spiffy CPAN distribution.

Report information
The Basics
Id: 18145
Status: new
Priority: 0/
Queue: Spiffy

People
Owner: Nobody in particular
Requestors: DRBEAN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.30
Fixed in: (no value)



Subject: overloading not working with fields
With this in Hello.pm: package Hello; use overload qw/""/ => 'foo'; sub new { bless {}, shift; } sub foo {$self = shift; return $self->{foo}}; 1; Overloading is working: main::(-e:1): 0 DB<1> use Hello DB<2> $a=Hello->new DB<3> x $a->{foo}=34 0 34 DB<4> x $a 0 Hello=HASH(0x934d360) 'foo' => 34 DB<5> x "$a" 0 34 DB<6> But with the use of Spiffy -base, and field 'foo': package Hello; use Spiffy -base; use overload qw/""/ => 'foo'; sub new { bless {}, shift; } field 'foo'; 1; We get: main::(-e:1): 0 DB<1> use Hello DB<2> $a=Hello->new DB<3> $a->foo(34) DB<4> x $a 0 Hello=HASH(0xa37f54c) 'foo' => 34 DB<5> x "$a" 0 '' DB<6> x $a->foo 0 undef DB<7> x $a 0 Hello=HASH(0xa37f54c) 'foo' => undef DB<8> Although without field 'foo': package Hello; use Spiffy -base; use overload qw/""/ => 'foo'; sub new { bless {}, shift; } sub foo {$self = shift; return $self->{foo}}; 1; It is OK: main::(-e:1): 0 DB<1> use Hello DB<2> $a=Hello->new DB<3> $a->{foo} = 34 DB<4> x $a 0 Hello=HASH(0x9801174) 'foo' => 34 DB<5> x "$a" 0 34 DB<6> x $a->foo 0 34 DB<7> So fields don't seem to allow overloading. This is perl, v5.8.3 built for i386-linux-thread-multi [greg@momotaro Games-Tournament-Swiss]$ uname -a Linux momotaro.chinmin.edu.tw 2.6.5-1.358 #1 Sat May 8 09:04:50 EDT 2004 i686 i686 i386 GNU/Linux [