Quoth "" <>:
>
> I have associate the perl executable to the .pl extension. The file
> association works fine when I don't use the command line arguements,
> but fails when I pass the command line arguements. When I execute the
> same command by appending the perl command in the beginning, it works
> fine. Does anyone know how to get around the problem? I am using perl
> 5.8.8 and I downloaded it from the activestate website.
You have the association wrong. On my windows machine, I get:
C:\DOCUME~1\Ben\Desktop>type foo.plx
#!perl -l
use Win32::TieRegistry Delimiter => '/';
print for @ARGV;
my $type = $Registry->{'Classes/.plx//'};
my $verb = $Registry->{"Classes/$type/shell//"};
print $Registry->{"Classes/$type/shell/$verb/command//"};
C:\DOCUME~1\Ben\Desktop>foo.plx a b c
a
b
c
"C:\Perl\bin\perl.exe" "%1" %*
C:\DOCUME~1\Ben\Desktop>
In particular, note the %* in the last line of output. ISTR I had to put
that in myself: the windows 'Open with...' dialog didn't. (I use .plx
rather than .pl for Perl programs to be executed, rather than
Perl4-style library files.) Another useful setting is
$Registry->{"Classes/$type/shellex/DropHandler//"} =
$Registry->{'Classes/exefile/shellex/DropHandler//'};
(with $type as above) which will (once the above association is correct)
allow you to drag-and-drop files onto a .plx file to invoke it with
those filenames. Unfortunately they are always short (8.3) names, but
that can be fixed with Win32::GetLongPathName if necessary.
Ben
--
It will be seen that the Erwhonians are a meek and long-suffering people,
easily led by the nose, and quick to offer up common sense at the shrine of
logic, when a philosopher convinces them that their institutions are not based
on the strictest morality. [Samuel Butler, paraphrased]