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

Re: Re: Was my module used or required?

by Biker (Priest)
on Dec 06, 2002 at 11:10 UTC ( #218032=note: print w/replies, xml ) Need Help??

in reply to Re: Was my module used or required?
in thread Was my module used or required?

"Why would you care?"

I'd like to know if a BEGIN block in my module is executed in the beginning of the applications execution or if it's executed later on, as a result of the module being require'd. seems to have a temporary outage on the search facility. I've read the Camel but not found what I was looking for. Just hoped someone could tell me what I missed. ;-)

caller and the node you referenced to talks about how a method is called. I need to know if my module was loaded in compile time or during run time.

Thanks anyway.

Everything went worng, just as foreseen.

Replies are listed 'Best First'.
Re: Re: Re: Was my module used or required?
by Jenda (Abbot) on Dec 06, 2002 at 11:29 UTC

    If you know about BEGIN{} blocks you should also know that there is not two separate compile and runtime phases. These two are interleaved. Even if neither you nor the module authors use any BEGIN blocks!

    I'm afraid you'll have to rethink this. Consider this:

    #!/usr/bin/perl BEGIN { push @INC, '/some/directory'; require Your::Module; } ...

    This way your module is being included as soon as at all possible, yet it's require()d, not use()d.

    If you tell us what and why do you want to do differently we can come up with something. Just now my only idea is to set a variable when the script "starts". $My::Module::Runtime=1 is probably the best you can get.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2022-01-27 21:37 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (71 votes). Check out past polls.