in reply to Re: File::Find considered hard?
in thread File::Find considered hard?

Does it really use global variables (err, variables in the main package; I assume it doesn't use the truly global punctuation variables, other than for their intended uses), or does it use package variables in its own package?

Call them package variables if you want to -- they still meet the definition of "global variable" in most languages, i.e. they are read/write accessible by any code from anywhere. I'm not going to go into a whole explanation of why using globals to pass information, regardless of the use of OO or not, is a really bad design, because many other people have written about it at length. It's not as if these globals are being used internally only -- they are part of the public API for File::Find.

Replies are listed 'Best First'.
Re: Re: Re: File::Find considered hard?
by dragonchild (Archbishop) on Mar 15, 2004 at 18:48 UTC
    One can also make the same claim about $DBI::errstr ... globals may be "Bad Things"(tm), but it's not as if they're unusable.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

      Of course $DBI::errstr comes with exactly the same caveats. The fact that File::Find::find() is not reentrant because of its use of package variables f.ex can be very annoying, and the same goes for $DBI::errstr in modular code. Just like $_ clobbering issues and what other commonly encountered cases of being bit in the rear by use of package variables there are.

      Makeshifts last the longest.