Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

•Re: Dual personality: Module and script

by merlyn (Sage)
on Aug 03, 2004 at 15:11 UTC ( [id://379684]=note: print w/replies, xml ) Need Help??


in reply to Dual personality: Module and script

If I read you correctly (and it is still early in the morning here), you want caller:
caller EXPR caller Returns the context of the current subroutine call. In sca +lar context, returns the caller's package name if there is a c +aller, that is, if we're in a subroutine or "eval" or "require", +and the undefined value otherwise. [....]
So, unless (defined caller) { ... } will execute that code if it's being brought in as the main level of the program, rather than a module.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (8)
As of 2024-04-19 13:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found