Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > perl command line arguements

Reply
Thread Tools

perl command line arguements

 
 
mrinalini.sukumar@gmail.com
Guest
Posts: n/a
 
      11-10-2006
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.

 
Reply With Quote
 
 
 
 
Ben Morrow
Guest
Posts: n/a
 
      11-10-2006

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]
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
command line arguements with spaces in them raphfrk@netscape.net C Programming 40 07-24-2006 11:14 PM
use one line Perl command to add a line at the begin of a file Ting Wang Perl Misc 3 12-13-2005 06:07 PM
accessing and storing character arguements from command line Dawn Minnis C Programming 9 02-28-2005 07:01 AM
sending command line arguements to HTML Tidy d davis Perl 0 04-27-2004 02:23 PM
Perl Arguements Paul Perl Misc 11 09-10-2003 05:43 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57