help gettin started with xampp and perl

Problems with the Windows version of XAMPP, questions, comments, and anything related.

help gettin started with xampp and perl

Postby awesomebill61 » 24. November 2007 06:05

i just installed xampp and the perl add-on on my system.

reading through the perl manual and documentation, they talk about locating the interpreter in the first line of every script on unix systems, and go into some detail of the alternatives to use on windows systems.

i'm running my xampp on windows and would like to know what line i need to put into my code to get it to run.

thank you!
awesomebill61
 
Posts: 3
Joined: 24. November 2007 05:56
Location: USA

Postby Izzy » 24. November 2007 08:18

i'm running my xampp on windows and would like to know what line i need to put into my code to get it to run.

The line to add to every .cgi or .pl file is often referred to as the shebang.
For example, in this snippet:
Code: Select all
#!"C:\xampp\perl\bin\perl.exe"

use CGI;

$form=new CGI;

$f_name=CGI::escapeHTML($form->param("f_name"));
$f_email=CGI::escapeHTML($form->param("f_email"));
$f_text=CGI::escapeHTML($form->param("f_text"));
etc.etc.


It goes at the very top of these files and refers to the absolute path of the Perl interpreter - perl.exe - no spaces above this line.

It looks like this but your path to perl depends on where you installed XAMPP:
#!C:/xampp/perl/perl.exe

If you use the Windows path format and\or you have spaces in a directory name then you need to enclose the path in quotes:
#!"C:\xampp\perl\perl.exe"

From a command console prompt you can issue commands to verify your perl version and what perl switches can be used on the shebang line or from a command prompt:
http://community.apachefriends.org/f/viewtopi ... 7109#87109


===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby awesomebill61 » 25. November 2007 00:21

okay, so i created this simple script:
Code: Select all
#!"C:\xampp\xampp\perl\bin\perl.exe"

print "Hello World";


when i try to open it up in my web browser, i just get a blank white page.
awesomebill61
 
Posts: 3
Joined: 24. November 2007 05:56
Location: USA

Postby Izzy » 25. November 2007 01:07

Try to follow the example scripts in the xampp\cgi-bin directory for clues about perl code.

Try this for yoursimplescript.cgi:
Code: Select all
#!"C:\xampp\xampp\perl\bin\perl.exe"

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

print "Hello World";

You have to tell perl what type of content requires printing.

Other things to check for:
The server is running?

You put yoursimplescript.cgi in the cgi-bin.

You went through the server so that perl.exe is parsed.
http://localhost/cgi-bin/yoursimplescript.cgi

Or you put yoursimplescript.cgi in the htdocs directory.

You went through the server so that perl.exe is parsed.
http://localhost/yoursimplescript.cgi

BTW
C:\xampp\xampp\ is not a good location to install XAMPP to which may course some issues - although is not related to your cgi issues.

Try to install to just C:\xampp
http://www.apachefriends.org/en/xampp-windows.html#1156



===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby awesomebill61 » 25. November 2007 02:45

thank you!
the content-type line fixed it and now the script outputs.

i'm going to reinstall xampp in a top level directory to prevent any future problems.

two more questions i have:
what are the differences between the .pl extension and the .cgi extension, and which is 'better'?

what are the differences between the cgi-bin and the htdocs directory?
awesomebill61
 
Posts: 3
Joined: 24. November 2007 05:56
Location: USA


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 65 guests