perl command line arguements

M

mrinalini.sukumar

Hi,

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.
 
B

Ben Morrow

Quoth "[email protected] said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top