Page 1 of 1

Still having trouble with Perl

PostPosted: 08. November 2008 02:04
by tryin_to_learn
I've installed the Perl add-on, run setup_xampp.bat file, restarted Apache. Status shows that Perl is running. However, I right click on the pl file I'm wanting to run, open with cmd.exe, and try running the script and get this:

Microsoft Windows [Version 6.0.6000]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
C:\xampp\htdocs\__shrinkOffice\tools\NPPES>export.pl

Microsoft Windows [Version 6.0.6000]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
C:\xampp\htdocs\__shrinkOffice\tools\NPPES>perl export.pl
'perl' is not recognized as an internal or external command,
operable program or batch file.

As you can see, I've tried just entering the file name (export.pl) and also entering perl export.pl - neither seems to work. Anyone have any ideas?

PostPosted: 08. November 2008 03:04
by Sharley
Try perl.exe not just perl and make sure the path to your perl installation is reflected in the first line of the script (shebang).
For example:
#!"C:\xampp\perl\bin\perl.exe"

I have just tried it on my PC and both perl and perl.exe work for me at the command console.
I also have the shebang in all my perl scripts.

Try this but change the path to perl to your own - this was my test script:
Code: Select all
#!C:/xampp/perl/bin/perl

print "Content-Type: text/html\n\n";

print "OK";


If that fails then?????

PostPosted: 08. November 2008 04:14
by tryin_to_learn
I tried perl.exe - also used your test script with the shebang line (my path is the same as yours) and I'm still getting the same results:

Microsoft Windows [Version 6.0.6000]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.

C:\xampp\htdocs\__shrinkOffice\tools\NPPES>susanTest.pl
Microsoft Windows [Version 6.0.6000]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.

C:\xampp\htdocs\__shrinkOffice\tools\NPPES>perl susanTest.pl
'perl' is not recognized as an internal or external command,
operable program or batch file.

C:\xampp\htdocs\__shrinkOffice\tools\NPPES>perl.exe susanTest.pl
'perl.exe' is not recognized as an internal or external command,
operable program or batch file.

PostPosted: 08. November 2008 04:45
by Sharley
What Os are you using? Vista perhaps - Microsoft Windows [Version 6.0.6000] ?

If Vista then you may have to run your Command Console with elevated administrator privileges.

I posted a mini tutorial for another member here:
http://community.apachefriends.org/f/viewtopi ... 394#128394

Hope this helps.

PostPosted: 08. November 2008 05:48
by tryin_to_learn
Yes, unfortunately I have Vista and you may be on to something. I turned the UAC off within about an hour of having this computer. I was going nuts.

The "Open Command Prompt here" is a good trick - I was having to browse to cmd.exe each time. However, I still get the same results that I posted above. It seems like it's not seeing perl.exe, right?

PostPosted: 08. November 2008 06:01
by Sharley
Did you elevate the command prompt Console?

Try and see if you can run the perl script in the conventional manner by using your browser with XAMPP running - put the script in the C:\xampp\cgi-bin and call the script like this:
http://localhost/cgi-bin/susanTest.pl
or whatever you call the script.

You can also test if perl is working by going to...
http://localhost
...and from the left hand menu select Perl and click through the links and also the PerlInfo() link which is much like the phpinfo() information screen.

If all that works then you have those admin issues with Vista and need to elevate the command console.

PostPosted: 09. November 2008 16:05
by tryin_to_learn
Both the localhost . . . susanTest.pl and the perlinfo() link work just fine so I think you're right about it being the Vista admin issues. I finally got it to work by accessing the command prompt from Start>Run - that seems to automatically put me in the administrator mode (prompt is C:\Users\Susan) and from there, I could just navigate to the file I needed and run it. Thanks so much for your help. I learned a lot!