Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: "Default" method

by McA (Priest)
on Oct 08, 2014 at 12:17 UTC ( [id://1103161]=note: print w/replies, xml ) Need Help??


in reply to "Default" method

Hi,

you can do that with overloading the stringification operator in your class.

use overload ( '""' => sub { shift->to_string; }, );

where to_string is the method returning a string representation.

Regards
McA

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2024-03-29 13:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found