[tpm] Glob problem

arocker at vex.net arocker at vex.net
Tue Oct 27 12:19:32 PDT 2009


> First of all, you should know that many people on the Perl blogosphere,
> the
> Perl IRC world, etc. have little patience for people who say "We cannot
> install anything from CPAN."

Well, they can argue with the client's security officer. I did specify it
as a preference rather than a total inability. It's all very well
insisting on CPAN if you're just playing with yourself, but if there are
two ways of doing something, I'm going to pick the one that involves the
least interaction, especially with a scarce resource who's doing something
more important for me.

> The improvement here is conveying the meaning precisely -

Actually, glob expressed exactly what I wanted, shell-like filename
expansion.

> if you use File::Find people may think you want to traverse a directory
> recursively.

Not if they're reading the reference in "Perl in a Nutshell", which gives
no real indication of depth traversal. If they started with perldoc, they
might.

> You shouldn't pick the shortest way (you're not doing golf in production,

Not for the sake of golfing, but for clarity and simplicity. I don't
believe in recreating OS functions in user-space if it can be avoided. (I
see this happening a lot in modern programs, perhaps because programmers
feel a compulsion to use the stuff they were forced to learn in CS.)

> and/or performs better (runs faster, consumes less resources, etc.).

I'm only going to worry about performance if it turns out to be noticeably
egregious in practice. "Premature optimisation.. &c".




More information about the toronto-pm mailing list