[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-WebCGI] How art thou glob?



At 22:05 -0400 7/21/99, Richard Gordon wrote:
> At 19:54 -0400 07/21/1999, Randy M. Zeitman wrote:
>>question...what's the right format to glob while specifying a filepath?
> 
> chdir is used to change directories, but...

and `pwd` will give you the current directory. Remember to chomp the newline.

(Or see the Cwd module for something _really_ portable)

> 
> I really don't quite follow what you are trying to do here. First, a subroutine is usually called with
> 
> &get_files;
> 
> not
> 
> get_files();

Not as of Perl 5.  The & still works but is no longer required and may even be deprecated these days...  foo() is unambiguously a function call. So is &foo. foo is not. &foo() would be redundant.

> 
> Second, if you are trying to build a list of filenames from your perl code folder that end in .cde, you will be much happier using something like
> 
> opendir (INDIR, $indir);
> @dir = grep {/.+cde$/} readdir (INDIR);
> closedir (INDIR);


As to the glob... only * and ? are supported in MacPerl and they are "rigged" because there is no shell to talk to and * and ? are not Mac wildcards.

Thus it may be that you cannot do a glob within a path.  Have you tried
    chdir("BeCause:Desktop Folder:perl code")

and then do the glob(*.cde) from there (or the open with the grep as Richard suggests)?


what's this got to do with Web/CGI programming anyway?

- Vicki
-- --
       |\      _,,,---,,_       Vicki Brown <vlb@cfcl.com>
 ZZZzz /,`.-'`'    -.  ;-;;,_   Journeyman Sourceror: Scripts & Philtres
      |,4-  ) )-,_. ,\ (  `'-'  P.O. Box 1269  San Bruno  CA  94066
     '---''(_/--'  `-'\_) http://www.cfcl.com/~vlb  http://www.macperl.com

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org