Try both versions. Do you see the difference? The original version calls the as_string method of the object (which may be either an instance of the base class or a child) while the second calls always the as_string subroutine in the base class.package base; use overload '""' => sub { shift->as_string }, # '""' => \&as_string, fallback => 1; sub as_string { "this is a base class" } package child; @ISA = qw(base); sub as_string { "this is a child class" } package main; $obj = bless {}, "child"; print "\$obj=$obj\n";
Jenda
| XML sucks. Badly. SOAP on the other hand is the most powerfull vacuum pump ever invented. |
In reply to Re^2: RFC: Data::Taxonomy::Tags
by Jenda
in thread RFC: Data::Taxonomy::Tags
by The Mad Hatter
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |