Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Share data among different packages

by JavaFan (Canon)
on Dec 22, 2010 at 14:01 UTC ( #878536=note: print w/ replies, xml ) Need Help??


in reply to Share data among different packages

I know it's not good a idea to use global variables and global data structures.
That's the disadvantage of sound-bites. They evolve into dogmas, and people take it for gospel.

It's a bad idea to use global variables and global data structures for local use. But if you want information to be accessible globally, there's nothing wrong with global variables. ("Singleton solution" make use of global variables as well - it's just a global coderef instead of global scalar/array/hash). The alternative is to set up your data locally, and pass references to it to every subroutine that either needs it, or calls (directly or indirectly) a subroutine that needs it.


Comment on Re: Share data among different packages
Reaped: Re^2: Share data among different packages
by NodeReaper (Curate) on Dec 22, 2010 at 14:52 UTC

      Sorry, that is what googling for walkthroughs/tutorials is for. Why should we type out a 30 page essay yet again?

      If you have honestly tried and have a specific problem, copy the error message and the offending code into a node here (with <code></code> tags around the code) and we can help you out.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2014-09-23 06:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (210 votes), past polls