[tpm] Anomalous globular behaviour?

Indy Singh indy at indigostar.com
Fri Apr 24 09:28:24 PDT 2009


I would just be pragmatic and add a '-f' test on the file name.  You probabaly need a check anyway because even the values returned 
by glob are not always going to be files, they can be directories.

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.

Indy Singh
IndigoSTAR Software -- www.indigostar.com


----- Original Message ----- 
From: <arocker at vex.net>
To: <tpm at to.pm.org>
Sent: Friday, April 24, 2009 12:03 PM
Subject: [tpm] Anomalous globular behaviour?


> I've just run across what seems to be an anomalous behaviour of glob.
>
> If glob is looking for a wildcarded string, e.g. glob "findit*", if findit
> is present, the value returned will be "findit". If it is not present,
> null is returned.
>
> Without the wildcard, i.e. glob "findit" the string "findit" will be
> returned, whether or not there is a file by that name.
>
> To summarise:
> Literal Matching file?  glob returns   shell behaviour (e.g. ls -l)
>
> f3           Yes                f3     f3 directory information
> f3*          Yes                f3     f3 directory information
>
> f4           No                 f4     cannot access f4
> f4*          No                null    cannot access f4*
>
> This seems wrong to me, and the Camel doesn't refer to the behaviour. Has
> anybody an explanation?
>
> _______________________________________________
> 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