Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: conditional self-execution

by kyle (Abbot)
on Jan 28, 2008 at 03:11 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://664612]
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 00:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found