develooper Front page | perl.fwp | Postings from July 2003

RE: my if?

Thread Next
From:
Pense, Joachim
Date:
July 3, 2003 03:59
Subject:
RE: my if?
Message ID:
630BE70C8320D6118D240002A589ABB2088BA731@DERUM201
> I think your training is to fault. Consider that files are a lexical
> scope as well, as if their were braces. Were subs not visible outside
> of a scope, we wouldn't have modules and objects as we have them now.

Files are different.

> 
> > Is there a sensible way of combining the advantages, that 
> is: defining subs
> > outside of blocks that share static variables anyway? 
> Whatever I can think
> > of would be even worse than version one (more complicated, 
> less intuitive,
> > more error-prone), so has anyone else thought of a concept? 
> 
> 
> You could always use a package variable - but those would be visible
> to other subs as well. 

This would definitely not be the solution

> But since you don't want to group subs in a scope anyway...

I think using objects that have the shared variables as attributes of
objects for which the subs are methods, but this is of course overkill for
small programs.

Joachim

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About