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

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 musing on the Monastery: (4)
As of 2015-10-07 03:15 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (170 votes), past polls