Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^2: To initialise or not to initialise?

by skyknight (Hermit)
on Jun 24, 2004 at 14:35 UTC ( #369374=note: print w/replies, xml ) Need Help??

in reply to Re: To initialise or not to initialise?
in thread To initialise or not to initialise?

Oh - and I don't have global variables. Just having them is a sign of logical weakness, initialized or not.

Eh, we should be careful how we define "globals" when making such statements. Indeed in strictly procedural programs it is foolish and unnecessary to have global variables. However, what about package globals? Having in Perl what would be denoted in other languages as a "static class member" is not an unreasonable thing to do, and is often in my experience necessary.

  • Comment on Re^2: To initialise or not to initialise?

Replies are listed 'Best First'.
Re^3: To initialise or not to initialise?
by dragonchild (Archbishop) on Jun 24, 2004 at 18:11 UTC
    Those aren't globals. Those are static class members. That they are implemented as a package global is completely and utterly irrelevant. The same goes for any other CS construct you can think of that in Perl is implemented as a package- or file-scoped global. Truly global variables are good for three things only:
    1. Hacking a one-off
    2. Prototyping
    3. Demonstrating how p00r yur skillz R

    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested

      Well clearly we are in fundamental agreement. At this point we are just arguing linguistic semantics.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2021-10-24 16:47 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (89 votes). Check out past polls.