[26762] in Perl-Users-Digest
Perl-Users Digest, Issue: 8837 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 7 06:05:23 2006
Date: Sat, 7 Jan 2006 03:05:04 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 7 Jan 2006 Volume: 10 Number: 8837
Today's topics:
Re: globbing files with spaces in the path <news@lawshouse.org>
Re: globbing files with spaces in the path <noreply@gunnar.cc>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 07 Jan 2006 10:15:49 +0000
From: Henry Law <news@lawshouse.org>
Subject: Re: globbing files with spaces in the path
Message-Id: <1136628950.2168.0@doris.uk.clara.net>
Scott Bass wrote:
> Lastly, I want to configure this script as a custom action in Windows
> Explorer (say I call it "Batch Submit"), such that RMB --> "Batch Submit"
I'm looking forward to someone showing me what I missed (well, sort of
..) but my experience of these context menu actions is that you have to
code them as perlSCRIPT, which is different from Perl. For example
@ARGV doesn't work - it's empty as I remember - and you have to code
> my $args = $WScript->Arguments;
... and then process $args->Arguments as an array. I couldn't find a
way of running Perl debug on these perlscripts either; had to code
dozens of $WScript->Echo("Such-and-such is happening") lines and dismiss
dozens of message boxes.
It's been a while since I tangled with it.
--
Henry Law <>< Manchester, England
------------------------------
Date: Sat, 07 Jan 2006 11:49:38 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: globbing files with spaces in the path
Message-Id: <429kibF1h2qs1U1@individual.net>
Scott Bass wrote:
> This seems to have fixed the issue:
>
> use File::Glob ':glob';
>
> # glob files specified on the command line
> my @files;
> while (@ARGV) {
> push @files, bsd_glob(shift @ARGV);
> }
<snip>
> If I can do the above (process command line wildcards) using opendir and
> readdir, could someone post a code snippet?
Well, when mentioning those functions, I had another idea about how to
feed the input to the script. But maybe something like this:
my @files;
while (@ARGV) {
push @files, myglob(shift @ARGV);
}
sub myglob {
my $arg = shift;
my ($dir, $ext);
if ( $arg =~ /^(c:.*)\\\*\.(\w+)$/i ) {
($dir, $ext) = ($1, $2);
} else {
die "Unexpected argument: $arg\n";
}
opendir my $dh, $dir or die "Couldn't open $dir: $!\n";
map { "$dir\\$_" } grep /\.$ext$/, readdir $dh;
}
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 8837
***************************************