No such thing as a small change | |
PerlMonks |
Re: Moose stringification overloading isn't workingby Anonymous Monk |
on Feb 10, 2013 at 07:29 UTC ( [id://1018030]=note: print w/replies, xml ) | Need Help?? |
Your output has two different classes in it: Zep is OT::Zeppelin::AddVendorKey stringifies as OT::Zeppelin::AddVendorKey…. _stringify returns OT::DB::Result::Upload... So it looks like the line $this->row->ID can return two different objects. The 'use overload' docs say: The subroutines for '""' , '0+' , and 'bool' can return any arbitrary Perl *value*. If the corresponding operation for this *value* is overloaded too, the operation will be called again with this *value*. As a special case if the overload returns the object itself then it will be used directly. An overloaded conversion returning the object is probably a bug, because you're likely to get something that looks like YourPackage=HASH(0x8172b34) . Based on the order of the output, I would say that $this->row->ID is returning $this in some cases, and in other cases it is returning an object of the class OT::DB::Result::Upload, and that class has also overloaded '""'. Here is a simple example of that:
In Section
Seekers of Perl Wisdom
|
|