in reply to Re^3: Why do I get a "used only once" warning here?
in thread Why do I get a "used only once" warning here?

What I wanted to illustrate is that a package variable may be declared in any package at any time (with either use vars or our), and may then be accessed from any other package at any (executionally subsequent) time.

I see. I had misunderstood you here. So I would declare it for instance in the logging package. Makes sense.

-- 
Ronald Fischer <ynnor@mm.st>
  • Comment on Re^4: Why do I get a "used only once" warning here?

Replies are listed 'Best First'.
Re^5: Why do I get a "used only once" warning here?
by AnomalousMonk (Archbishop) on Mar 17, 2009 at 15:53 UTC
    So I would declare it for instance in the logging package.
    Exactly. Or, you could declare it in a package of your own definition as you seem to have originally intended. The latter course avoids the possibility that a 'reasonable' name given by you to your variable might at some later time be used by the maintainer of the logging module you're using, thus engendering a naming collision with effects that might suddenly appear from the blue and be rather puzzling and difficult to debug.

    Or, you could make your new package inherit from the logging module you're using, extending the attributes and functions of the old module... but that's a whole 'nother discussion!