perl command line arguements

Discussion in 'Perl Misc' started by mrinalini.sukumar@gmail.com, Nov 10, 2006.

  1. Guest

    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.
    , Nov 10, 2006
    #1
    1. Advertising

  2. Ben Morrow Guest

    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]
    Ben Morrow, Nov 10, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. d davis
    Replies:
    0
    Views:
    469
    d davis
    Apr 27, 2004
  2. Rob Meade
    Replies:
    5
    Views:
    447
    Rob Meade
    Dec 5, 2005
  3. Dawn Minnis
    Replies:
    9
    Views:
    358
    Dave Thompson
    Feb 28, 2005
  4. Replies:
    40
    Views:
    846
    Michael Wojcik
    Jul 25, 2006
  5. Paul

    Perl Arguements

    Paul, Sep 8, 2003, in forum: Perl Misc
    Replies:
    11
    Views:
    187
    Michael P. Broida
    Sep 10, 2003
Loading...

Share This Page