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

Re: Checking for duplicate subroutine names

by flexvault (Monsignor)
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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2018-02-20 09:54 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (268 votes). Check out past polls.