Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Win7 doesn't fill @ARGV

by hsfrey (Beadle)
on Nov 19, 2013 at 18:51 UTC ( [id://1063372]=perlquestion: print w/replies, xml ) Need Help??

hsfrey has asked for the wisdom of the Perl Monks concerning the following question:

I installed perl (from the perl.org site) on my new Win7 system.

It works fine, except the system doesn't pass command line arguments to @ARGV.

I suspect it's a registry problem in HKEY_CLASSES_ROOT, but I can't find out exactly where or what to put there.

Any suggestions?

Right now, I'm reduced to using a batch file which writes the arguments to a temporary file which I open in the program. Ugh!

Replies are listed 'Best First'.
Re: Win7 doesn't fill @ARGV
by GrandFather (Saint) on Nov 19, 2013 at 20:35 UTC

    How are you running your Perl scripts? Command line? Desktop shortcut? Drag and drop onto a shortcut? Double click in Explorer?

    I use drag and drop to shortcuts on the desktop frequently. The target line in the shortcut looks like:

    C:\Perl\bin\wperl.exe C:\Tools\MyTool.pl

    Using the command line works exactly as expected. Double clicking in the Explorer opens a script for editing.

    True laziness is hard work
Re: Win7 doesn't fill @ARGV
by BrowserUk (Patriarch) on Nov 19, 2013 at 19:01 UTC

    Post the output from the following command run on your machine:

    ftype perl

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Thanks. It says: perl="C:\Perl64\bin\perl.exe" "%1" %*, which is exactly what I found in the registry in the data field at HKEY_CLASSES_ROOT\pl_auto_file\shell\open\command. However, .pl is associated with C:\Perl\bin\perl.exe, i.e. not perl64. I tried to modify the command to remove the 64, but even though I thought I was running as administrator, the modify instruction wouldn't work. The alternative would be to aim all my perl instructions to perl64 instead of perl. Is there any advantage to using perl64 (v. 5.16.3)instead of perl (v. 5.12.4) on this 64 bit machine?
        It says: perl="C:\Perl64\bin\perl.exe" "%1" %*, which is exactly what I found in the registry in the data field at HKEY_CLASSES_ROOT\pl_auto_file\shell\open\command. However, .pl is associated with C:\Perl\bin\perl.exe, i.e. not perl64.

        That's very confusing. So which version (32-bit or 64-bit) did you install? And if you've installed both, which did you install last?

        I tried to modify the command to remove the 64, but even though I thought I was running as administrator, the modify instruction wouldn't work.

        Hm. How did you try to change it?

        What happened when you tried to change it? ie. did you get any error messages?

        The alternative would be to aim all my perl instructions to perl64 instead of perl.

        If you can't change it one way, why would you be able to change it the other?

        Is there any advantage to using perl64 (v. 5.16.3)instead of perl (v. 5.12.4) on this 64 bit machine?

        There are several advantages to using a 64-bit build of perl (regardless of the version).

        1. 32-bit perls are limited to 2GB of memory. With 64-bit you can use all the memory available on your machine.
        2. For many operations, the 64-bit version will run the identical code more quickly -- substantially so in some cases.

        Of course, there are also downsides:

        • The same program and data will occupy more memory -- up to double for some types of data.
        • It can be harder or even impossible to get some XS-based modules to compile under 64-bit.

        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Win7 doesn't fill @ARGV
by sundialsvc4 (Abbot) on Nov 20, 2013 at 04:45 UTC

      Nice find. Thanks! The SO article points to something specific to Win 7 that I hadn't seen singled out before (and that appears to have fixed this problem for more than one person).

      - tye        

Re: Win7 doesn't fill @ARGV
by VinsWorldcom (Prior) on Nov 19, 2013 at 19:10 UTC

    Mine looks like:

    [HKEY_CLASSES_ROOT\.pl] "Perl_program_file" [HKEY_CLASSES_ROOT\Perl_program_file\shell\Execute Perl Program\comman +d] "C:\strawberry\perl\bin\perl.exe" "%1" %*
Re: Win7 doesn't fill @ARGV
by ww (Archbishop) on Nov 19, 2013 at 20:54 UTC
    Your surmise may be correct, but as the profession tells Med students, "don't go hunting for zebras in Kansas." You have several other possibilities to explore, in the responses above... and several bits of info you haven't given us. They would probably help us to help you.

    Whatever, Win7, AS 5.16, & CLI gives me this:

    C:>perl -E "for (@ARGV) { say $_;}" abc def 123 "PM Question [id://106 +3372]" abc def 123 PM Question [id://1063372]
Re: Win7 doesn't fill @ARGV
by Anonymous Monk on Nov 19, 2013 at 22:18 UTC
Re: Win7 doesn't fill @ARGV
by taint (Chaplain) on Nov 19, 2013 at 20:16 UTC
    It's been a long time since I've been on a winboxen, so please pardon me.
    But is Perl (perl.exe) within your $PATH, or %PATH, or whatever it is Win uses these days?

    For example, does simply typing perl -V, produce anything || what you'd expect?

    Sorry, just a bit of a guess.

    --Chris

    #!/usr/bin/perl -Tw
    use Perl::Always or die;
    my $perl_version = (5.12.5);
    print $perl_version;

      Downvoted. Here's why:

      1. The OP says that his scripts aren't receiving arguments via @ARGV...

        How would he know that if he was unable to run the script?

      2. It is not necessary to have perl.exe in your path in order to be able to run perl scripts on windows.

        The assoc/ftype mechanism takes care of locating perl when the name of a perl script is typed at a command prompt; or .pl file is double clicked in the explorer.

      3. You say: "It's been a long time since I've been on a winboxen, so please pardon me." and then go on to give a (wrong) guess as an answer.

        Do not feel obliged to give answers on subjects you have no relevant knowledge of. There are others who will know.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1063372]
Approved by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-24 09:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found