[tpm] Anomalous globular behaviour?

Mark Fowle mfowle at navicominc.com
Fri Apr 24 10:28:24 PDT 2009


When looking at a flag file I use if (-e $file){...}

Actually the behavior seems reasonable to me.

"The glob angle-bracket operator <>  is a pathname generator that
implements the rules for file name pattern matching used by Unix-like
shells such as the Bourne shell or C shell."

It's goal is to create a list of pathnames, not to tell you if they
exist, although that is a side effect of expanding wildcard characters.
So if you ask what pathnames does fname expand to you get fname

Also from the docs:

GLOB_NOCHECK

If the pattern does not match any pathname, then bsd_glob() returns a
list consisting of only the pattern.





-----Original Message-----
From: toronto-pm-bounces+mfowle=navicominc.com at pm.org
[mailto:toronto-pm-bounces+mfowle=navicominc.com at pm.org] On Behalf Of
arocker at vex.net
Sent: Friday, April 24, 2009 1:04 PM
To: tpm at to.pm.org
Subject: Re: [tpm] Anomalous globular behaviour?

> I would just be pragmatic and add a '-f' test on the file name.

That's probably a sensible thing to do in a general case, but the code
that started this particular hare was simply a test script using a flag
file to indicate whether a loop should abort or continue. That's why I
was
looking for a string rather than a more complicated expression.

> The source code for this is in the File::Glob module in the file
> bsd_glob.c in the function bsd_glob if you care to look at it.  It
> is not that easy to understand.

Even with that warning I may well take a look. Thanks for the
information.

_______________________________________________
toronto-pm mailing list
toronto-pm at pm.org
http://mail.pm.org/mailman/listinfo/toronto-pm


More information about the toronto-pm mailing list