in reply to Can't pass parameters in Win32 Perl Scripts

Invocation through filename associations doesn't work in my experience. I always launch my scripts by using

perl -w scriptname.pl

or convert them into executable form by using pl2bat.cmd.

Replies are listed 'Best First'.
Re^2: Can't pass parameters in Win32 Perl Scripts
by ronniec (Sexton) on Oct 25, 2006 at 12:13 UTC
    Thanks that did the trick!! It may not be as neat as the Getopt:Std version but it does work!! Cheers!
    PS I loaded Perl onto yet another machine and yes the original script works there! (Only my office PC causes it to fall through!?)

      Assuming all other factors are equal, what is ".pl" associated with on you office PC? What is it associated with on the other PCs?

      BTW for extra fun try getting a shortcut to a perl program running with parameters specified in the shortcut... I've only ever got this to work via a batch file...

      Tom Melly, tom@tomandlu.co.uk
Re^2: Can't pass parameters in Win32 Perl Scripts
by pKai (Priest) on Oct 25, 2006 at 13:49 UTC
    Invocation through filename associations doesn't work in my experience.

    Years ago I had one NT4-Box at work with the same symptoms and have also seen the same problem reported a few times in Perl fora over the years.

    Apart from that, parameter passing to calls using extension association has never been a problem for me again (using it all the time.)

    If anyone knows how to *repair* such an incident, I would be interested to hear about it. If only to satisfy my curiosity.

      One idea I have is, that possibly the filetype isn't set up correctly by whatever installs the association:

      Q:\>ftype perl perl="C:\Programme\perl\bin\perl.exe" "%1" %* Q:\>type tmp.pl #!/usr/bin/perl -l print for @ARGV; Q:\>tmp.pl 1 2 3 4 5 1 2 3 4 5

      So on this machine, with this setup, it works. If the association is set up wrongly (which I can't check as I don't have access to a non-working machine at the moment), for example by double-clicking a .pl file and then choosing perl.exe, then likely the execution from the command line doesn't work either:

      Hypothetical:\>ftype perl perl="C:\Programme\perl\bin\perl.exe" "%1"
        which I can't check as I don't have access to a non-working machine at the moment

        That's my problem, too. When I had access years ago, i was not knowlegdable enough to check the stuff out.

        I remember one other forum case, where it seemed that the ftype/assoc was set correct, though parameter passing was ascrew. Thus my question for a report of an actuall working repair.