Page 1 of 1

Perl with XAMPP

PostPosted: 08. January 2008 09:14
by Swan
I am not getting on how to start Perl after installing XAMPP. The XAMPP control panel doesnot provide any switch to start with Perl, which it provides for MYSQL, APACHE, Squirrel Mail etc.

Please Help . :)

PostPosted: 08. January 2008 09:42
by Izzy
Perl is a scripting language not a server - you don't start it like a server, you start it from a file that has the perl script code within, usually with a .cgi or .pl file xtension.

The line that starts Perl is called the shebang which is always the first line of the file holding the perl code - Google it.

This is typical shebang on an XAMPP installed Perl script.
#!"C:\xampp\perl\bin\perl.exe"

As you can see this is what starts the Perl interpreter.

PostPosted: 09. January 2008 03:14
by Swan
Thanks,
But I know it's a scripting language ( Just like PHP ) .
My query is : like a php script ( say myscript.php) is kept in htdocs to run it. ( URL : http://localhost/myscript.php) similarly, where i am supposed to keep the myscript.pl or myscript.cgi to run it on my localhost ?

I had tried keeping myscript.pl in htdocs. But it loads it as a text file inside the browser. The script doesnot undergo any compilation process. :(

PostPosted: 09. January 2008 06:05
by Izzy
But I know it's a scripting language ( Just like PHP ) .

Perl is not 'Just like PHP' - PHP is a server-side HTML embedded scripting language - PHP = HyperText Preprocessor.

Perl is treated differently to PHP by being contained within a Common Gateway Interface that the server knows the location of, and so will only use this CGI_BIN for executing code in an executable file (.pl or .cgi).

http://www.whenpenguinsattack.com/2006/ ... p-vs-perl/

You can't have, for obvious security reasons, executable files being executed all over the place.

I can hear you sat - "I know all that" - but IMHO your questions don't reflect your knowledge on the subject and so more reading should be in order.

So, your initial question I answered in detail as your question was, IMHO, a question from someone who knew absolutely nothing about Perl what so ever and my opinion has not changed one bit by your second question.

You are now asking another question entirely that is explained in detail if you care to read the cgi related items in the XAMPP for Windows home page
http://www.apachefriends.org/en/xampp-windows.html

and it would not hurt to read the XAMPP FAQ either
http://www.apachefriends.org/en/faq-xampp-windows.html

Also you should have read this before asking your very simple questions on these forums:
http://localhost/xampp/perl-info.php
http://localhost/perl/perlinfo.pl

All perl scripts go in the default cgi_bin until you change the location in the httpd.conf file or an httpd-vhosts.conf file as outlined in the XAMPP Home Page in case you missed it when your read that page.

PostPosted: 10. January 2008 06:42
by Swan
Izzy wrote:
But I know it's a scripting language ( Just like PHP ) .

Perl is not 'Just like PHP' - PHP is a server-side HTML embedded scripting language - PHP = HyperText Preprocessor.

Perl is treated differently to PHP by being contained within a Common Gateway Interface that the server knows the location of, and so will only use this CGI_BIN for executing code in an executable file (.pl or .cgi).

http://www.whenpenguinsattack.com/2006/ ... p-vs-perl/

You can't have, for obvious security reasons, executable files being executed all over the place.

I can hear you sat - "I know all that" - but IMHO your questions don't reflect your knowledge on the subject and so more reading should be in order.

So, your initial question I answered in detail as your question was, IMHO, a question from someone who knew absolutely nothing about Perl what so ever and my opinion has not changed one bit by your second question.

You are now asking another question entirely that is explained in detail if you care to read the cgi related items in the XAMPP for Windows home page
http://www.apachefriends.org/en/xampp-windows.html

and it would not hurt to read the XAMPP FAQ either
http://www.apachefriends.org/en/faq-xampp-windows.html

Also you should have read this before asking your very simple questions on these forums:
http://localhost/xampp/perl-info.php
http://localhost/perl/perlinfo.pl

All perl scripts go in the default cgi_bin until you change the location in the httpd.conf file or an httpd-vhosts.conf file as outlined in the XAMPP Home Page in case you missed it when your read that page.



cgi_bin for perl As htdocs for php...OK
Thanks a lot . :)

PostPosted: 10. January 2008 10:41
by Wiedmann
cgi_bin for perl As htdocs for php...OK

If you change this line in httpd.conf (~419):
Code: Select all
AddHandler cgi-script .cgi

to
Code: Select all
AddHandler cgi-script .cgi .pl

you can put your perl scripts also in htdocs.