On Sat, 2005-08-20 at 19:44 +0200, Frank Maas wrote:
> package A::B::C;
> my %CFG = ( some_tag => some_config, ... }
> ...
> sub do_something {
>   ...
>   do_something_else( $CFG{some_tag} );
>   ...
> }
> ...
> 1;
> 
> After reading much of this discussion I am beginning to wonder if I am 
> creating closures?

Your do_something() sub will keep a persistent value for %CFG here.  If
this is intended to be static data, that's not a problem.  I would use
an "our" here instead though for static data.

> (I must admit that the concept of closures is -for
> some reason- very hard for me to grasp)

You're not the only one.  Closures are my least favorite Perl feature
because they're so easy to use by accident and so hard to fully
understand.

- Perrin

Reply via email to