Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Can you limit the scope of require?

by dave_the_m (Monsignor)
on Jul 20, 2018 at 20:20 UTC ( #1218954=note: print w/replies, xml ) Need Help??


in reply to Can you limit the scope of require?

Difficult to comment without knowing what one of your .conf files looks like. One possibility is to use 'do' rather than 'require', and import each one into a different namespace. For example:
/tmp/foo.conf: sub f { print __PACKAGE__, "\n" } 1; main script: package P1; do '/tmp/foo.conf'; package P2; do '/tmp/foo.conf'; P1::f(); P2::f(); which outputs: P1 P2
Dave.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2019-05-20 22:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (129 votes). Check out past polls.

    Notices?