#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    7
    Rep Power
    0

    PL file ext association


    Hello. I am a retired Systems Programmer. I worked on several platforms. Some years ago, I ran windows servers and wrote my CGIs in Perl. But for the last dozen years or so, I worked on mainframes. Now I have been asked to write some Perl apps for a small business. And I am very rusty.

    I am trying to create a test server environment on a Windows 7 workstation. So I installed the latest Perl 5. The install messages said everything I expected about registry entries and such. However, the O/S does not recognize .PL files as Perl scripts. So when you click on them (or run them from HTML, etc), it does not invoke Perl.exe.

    I would be very grateful for any help the forum members can give. Thank you.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,968
    Rep Power
    1225
    Did you check that you actually have a .PL file type association? If so, what is the value for the Open command?

    i.e.,
    HKEY_CLASSES_ROOT\Perl\shell\Open\command

    The value should be similar to this: (adjust the path as needed)
    "C:\Perl\bin\perl.exe" "%1" %*
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    7
    Rep Power
    0
    Originally Posted by FishMonger
    Did you check that you actually have a .PL file type association? If so, what is the value for the Open command?

    i.e.,
    HKEY_CLASSES_ROOT\Perl\shell\Open\command

    The value should be similar to this: (adjust the path as needed)
    "C:\Perl\bin\perl.exe" "%1" %*
    Yes, it is there. Thanks.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,968
    Rep Power
    1225
    Are you saying it's now working, or do you still need help troubleshooting?
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    7
    Rep Power
    0
    Originally Posted by FishMonger
    Are you saying it's now working, or do you still need help troubleshooting?
    It is not working. The registry entry that you asked about "is there", where you would expect it to be. So the problem lies elsewhere.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,968
    Rep Power
    1225
    Is perl.exe within your path environment?

    Open a cmd window then execute your script and post the results.

    A print screen of the execution/results would be nice.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    7
    Rep Power
    0
    Here's the results:

    C:\>rcp.pl
    'rcp.pl' is not recognized as an internal or external command,
    operable program or batch file.

    C:\>
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,968
    Rep Power
    1225
    That error is telling me that your file type association is not setup correctly and/or perl.exe is not in your path.

    How To Change the Default Program for a Specific File Extension in Windows 7

    How to set the path in Windows 7

    Once those are set correctly, you should be able to run your script.

    Another approach, which I normally don't use myself, is to specify the full path to perl when executing the script.

    e.g.
    C:\>c:\perl\bin\perl.exe rcp.pl
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,968
    Rep Power
    1225
    I made a big assumption, which I shouldn't have done.

    Is your script in the same dir where you're executing it? If not, then you need to specify its path.

    e.g.,
    D:\>hello.pl
    'hello.pl' is not recognized as an internal or external command,
    operable program or batch file.

    D:\>d:\test\hello.pl
    Hello World!

    D:\>
  18. #10
  19. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    7
    Rep Power
    0
    Originally Posted by FishMonger
    I made a big assumption, which I shouldn't have done.

    Is your script in the same dir where you're executing it? If not, then you need to specify its path.

    e.g.,
    Yes, its in the same dir.

    But I've just discovered something else. The Perl script was a few print statements to create an HTML page. As a test, I changed it to an OPEN/PRINT FILE/CLOSE script to write a test line to a file. It does in fact execute the Perl script. So it appears that the problem is with printing HTML. Perhaps I'm missing some web-related service, or my script was wrong, or... what?
  20. #11
  21. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,968
    Rep Power
    1225
    I can't troubleshoot code I haven't seen.

    Please post your script.
  22. #12
  23. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    7
    Rep Power
    0
    Sorry, I'm not doing this well at all.

    Here's the 2 test Perl scripts:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    (1) #!/perl/bin/perl
    open (FILE, ">>temp_date_time.txt");
    print FILE "test line here\n";
    close (FILE);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    (2) #!/perl/bin/perl
    print '<html><head>';
    print 'test line here';
    print '</head></html>';
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    From a CMD window, they both work OK. That is, #1 writes to the file, and #2 prints the three lines in the CMD window.

    But invoked from HTML in browser, in both cases, it just lists the contents of the PL file in the browser.

    Here's the HTML invoke:
    <form method="post" action="test.pl">
    <P ALIGN="CENTER"> Press <input type=submit value="NEXT SCREEN"> to continue</p>
    </form>
  24. #13
  25. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,968
    Rep Power
    1225
    Your test scripts are poorly written, but that's not the main problem.

    Having the contents of the scripts displayed in the browser instead of the output of their execution tells us that the web server isn't configured to execute scripts from that location.

    What web server are you using? I'm assuming apache.

    What are the permission settings for the scripts? Typical setting is 655.

    Are the scripts in the cgi-bin directory or the same dir as the html files?

    Do you have a ScriptAlias directive configured in httpd.conf?
  26. #14
  27. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    7
    Rep Power
    0
    Huh? My TEST SCRIPTS are poorly written!? Oh, come on. Give me a break. I'm just trying to test the environment. Once I fix that problem, I can give some time to coding the application. I haven't written Perl in nearly 15 years.

IMN logo majestic logo threadwatch logo seochat tools logo