I've got a simple case working exactly as I expect and as documented, but a more complicated case NOT working. The main difference is that in the more complicated case, I'm accessing a child class of where I did the overload.
In the parent class I do:
use overload '""' => \&_stringify; sub _stringify { my $this = shift; # Actually operator arg, NOT a "this" $this->row->ID; };
I use it like this:
$logger->trace("Zep is " . ref($zep) . " stringifies as $zep" . " but +_stringify returns " . $zep->_stringify );
The resulting log line comes out like this: 20130209 15:27:30.041 TRACE TrafCon.pl 158 6070: Zep is OT::Zeppelin::AddVendorKey stringifies as OT::Zeppelin::AddVendorKey=HASH(0x378d480) but _stringify returns OT::DB::Result::Upload|upload|upload_id=1
OT::Zeppelin::AddVendorKey is a direct child of OT::Zeppelin, which is where the operator overload was done.
My head hurts, and the wall seems to still be fine. Any ideas?
In reply to Moose stringification overloading isn't working by dd-b
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |