Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: "Default" method

by McA (Priest)
on Oct 08, 2014 at 12:17 UTC ( #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? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2022-05-28 17:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (99 votes). Check out past polls.

    Notices?