Re: perl command line arguements




Quoth "mrinalini.sukumar@xxxxxxxxx" <mrinalini.sukumar@xxxxxxxxx>:

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] benmorrow@xxxxxxxxxxxxx
.



Relevant Pages

  • Re: Wait for background processes to complete
    ... To be able to execute commands in the background and wait for their ... The documentation I am referring to is http://perldoc.perl.org/. ... You can run a command in the background with: ... There is a general problem with perl documentation: ...
    (comp.lang.perl.misc)
  • Re: Memory: measuring 5 limitations
    ... >> This will give you information about the execution of the script. ... > Yeah I have shell access and I can execute the time command. ... If you can execute your script *without* typing in perl at the ...
    (comp.lang.perl.misc)
  • RE: setting unix command through perl script
    ... I am automating one task in Perl in which this command is ... If I don't execute this command then entire task would fail. ... setting unix command through perl script ...
    (perl.beginners)
  • Re: Linux
    ... You almost certainly have Perl already installed. ... But the actual command line interpreter should be the same between them. ... put the shebang line as the first line of the script. ... You can then execute the program ...
    (perl.beginners)
  • perl command line arguements
    ... I have associate the perl executable to the .pl extension. ... but fails when I pass the command line arguements. ...
    (comp.lang.perl.misc)