Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^5: Calling module function from within a blessed module

by shmem (Chancellor)
on Jan 02, 2021 at 19:50 UTC ( #11126159=note: print w/replies, xml ) Need Help??


in reply to Re^4: Calling module function from within a blessed module
in thread Calling module function from within a blessed module

Heh...

perl -E ' $o = bless \$o, 0; *{"0::barf"} = sub {say "woof $_[1]"}; $foo = 0; $foo->barf("warf"); say $o; $o->barf("chrrr, wuff!"); 0->barf("what?")' woof warf 0=REF(0x1267880) woof chrrr, wuff! woof what?

This is part of perl's flexibility I dearly love, and that shouldn't go away. I could - if there was a need for it! - even make integers into packages and let them have their own methods. Although those integers are strings as package names, perls builtin conversions just dwim.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2021-03-01 05:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?