Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: RFC: Data::Taxonomy::Tags

by Jenda (Abbot)
on Jun 23, 2005 at 00:59 UTC ( [id://469255]=note: print w/replies, xml ) Need Help??


in reply to Re: RFC: Data::Taxonomy::Tags
in thread RFC: Data::Taxonomy::Tags

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";
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.

Jenda
XML sucks. Badly. SOAP on the other hand is the most powerfull vacuum pump ever invented.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://469255]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-06-23 22:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.