Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Portability of glob function in a modern perl

by ccn (Vicar)
on Aug 12, 2005 at 08:46 UTC ( [id://483212]=note: print w/replies, xml ) Need Help??


in reply to Re: Portability of glob function in a modern perl
in thread Portability of glob function in a modern perl

I wonder how the perl can call csh on Windows? I thought that oldest perls just call default shell for the platform where they are running. The older perls emulate default shell. Modern perl emulates standard csh.
  • Comment on Re^2: Portability of glob function in a modern perl

Replies are listed 'Best First'.
Re^3: Portability of glob function in a modern perl
by ambrus (Abbot) on Aug 12, 2005 at 08:49 UTC

    Read the section about glob in the perldoc perlport of older perl versions if you are interested in these details.

      I've read the old an new docs and found only the following.

      Old perl

      perl-5.005_03 perlport
      glob EXPR
      glob
      
          Globbing built-in, but only * and ? metacharacters are supported. (Mac OS)
      
          Features depend on external perlglob.exe or perlglob.bat. May be
       overridden with something like File::DosGlob, which is recommended. (Win32)
      
          Globbing built-in, but only * and ? metacharacters are supported. Globbing
       relies on operating system calls, which may return filenames in any 
      order. As most filesystems are case-insensitive, even ``sorted'' filenames
       will not be in case-sensitive order. (RISC OS) 
      
      perl-5.005_03 perlop
      Because globbing invokes a shell, it's often faster to call readdir() yourself
       and do your own grep() on the filenames. Furthermore, due to its current
       implementation of using a shell, the glob() routine may get ``Arg list too long''
       errors (unless you've installed tcsh(1L) as /bin/csh).
      
      
      perl-5.005_02 perlwin32
      File Globbing
      
          By default, perl spawns an external program to do file globbing. The install
       process installs both a perlglob.exe and a perlglob.bat that perl can use for
       this purpose. Note that with the default installation, perlglob.exe will
       be found by the system before perlglob.bat.
      

      Modern perl

      perlport
      glob
      This operator is implemented via the File::Glob extension on most platforms. 
      See File::Glob for portability information.
      
      perlwin32
      File Globbing
      By default, perl handles file globbing using the File::Glob extension, which 
      provides portable globbing.
      
      And both old & new perls say:
      Don't count on filename globbing. 
      Use opendir, readdir, and closedir instead.
      Why can't I count on globbing in a modern perl? I found nothing in the docs.

        The hint Don't count on filename globbing is meant short for Don't count on that all glob parameters on the command line will have been expanded by the calling shell for you, because, on Win32 (and likely VMS), the shell doesn't expand glob filespecs.

        This is unrelated to the glob builtin, which "works" within the boundaries already given. The usage of File::Find and File::Find::Rule is still recommendable over manual reading or globbing via glob, because glob (and File::Glob) live under the assumption that whitespace is a sensible delimiter for glob patterns.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://483212]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 16:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found