Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Checking for duplicate subroutine names

by flexvault (Prior)
on Oct 12, 2012 at 16:05 UTC ( #998733=note: print w/ replies, xml ) Need Help??

in reply to Checking for duplicate subroutine names


Look at the use of 'package'. I believe that all variables and subroutines are defined by package.

One way to do what you want is name your code as 'package'. Since your using require to bring the script into your main package, load your package via 'use' at the beginning of execution, and then loop on the require part which will include calls to your subroutines for building the user's script. I would also put the loop in an 'eval'.

Other Perl Monks will have more experience with 'package' (hint: you need it for CPAN). I've only used it once or twice.

Good Luck

"Well done is better than well said." - Benjamin Franklin

Comment on Re: Checking for duplicate subroutine names

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2015-08-28 16:12 GMT
Find Nodes?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...

    Results (337 votes), past polls