Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: How to initialize a Global in a module

by Anonymous Monk
on Oct 26, 2011 at 14:00 UTC ( [id://933903]=note: print w/replies, xml ) Need Help??


in reply to How to initialize a Global in a module

One good way to approach things is to say that all of your modules will contain 'subroutines' or 'objects,' and if necessary maybe a subroutine that creates a singleton object-instance on demand. Now you have a well-defined way for things to be initialized, and while the methods of the object are executing they have a well-defined "place to put things," i.e. the object itself. This also naturally encourages you to put the logic where it properly belongs ... right there alongside the data that's being manipulated. Values can easily be initialized either in the "new()" method, or lazily, on-demand, and all of that plumbing-work is right there where you'd expect it to be, not scattered all over the application. It works out really well in practice.
  • Comment on Re: How to initialize a Global in a module

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2024-04-23 13:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found