Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: conditional self-execution

by kyle (Abbot)
on Jan 28, 2008 at 03:11 UTC ( #664612=note: print w/replies, xml ) Need Help??


in reply to conditional self-execution

What you're describing sounds to me like a modulino.

Update: In a nutshell, the way it's done is something like this:

package Foo; _run( @ARGV ) if ! caller; sub _run { # Do stuff as a program }

It's using caller to tell whether it's being executed "at the top level". If you search for modulino on CPAN, there are a few examples to look at.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2020-12-05 12:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (63 votes). Check out past polls.

    Notices?