Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: How to call a perl function without its context?

by KurtSchwind (Chaplain)
on Jul 28, 2015 at 11:59 UTC ( [id://1136595]=note: print w/replies, xml ) Need Help??


in reply to How to call a perl function without its context?

You could make a package that doesn't reference anything else. Slap a function in the object and call it.

package MyIsolatedFunction; my $singleton = undef; sub new { my( $class ) = @_; return $singleton if defined $singleton; my $self = 0; $singleton = bless \$self, $class; return $singleton; } sub isolatedFunction { ... # Normal function stuff here. } 1;
--
“For the Present is the point at which time touches eternity.” - CS Lewis

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-03-28 12:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found