# Firefox not Executing Perl Code



## Hal356 (May 13, 2007)

Hello everyone!

So, don't pay attention to my computer stats, as now I own a Macintosh, however, I've been having problems getting a Perl code to execute in Firefox, or any other browser on my computer for that matter!?!?! I'm so confused, because on another computer that I use a remote server, it's able to read it.

So this is what I do.

I make the Perl code in the terminal using Vim:

_#!usr/bin/perl

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

print " \n";
print "Welcome to the world of Perl! Please enjoy yourself  \n";
print " \n";_

and then I save the file as hsimmon.2.2.pl and exit out of Vim, and run the code at the command line, and this is what I get:

_Content-type:text/html

Welcome to the world of Perl! Please enjoy yourself  
_

Next, I move to the browser (firefox), and I type the location into the address bar as such:

_file:///Users/harrysimmons/root/perl_backup/hsimmons/S2.2/hsimmon.2.2.pl_

Then, the output of the browser does not execute the code, it just displays all of the code in a plain text format. Is it because it's not running through Perl first? How am I able to make the code run through Perl first, and then submitted to the browser?

Any help would be appreciated.


----------



## JimmySeal (Sep 25, 2007)

Firefox does not run Perl code (nor does any major browser). When making webpages using Perl and other server-side scripting languages, the Perl code is run on the _web server_ and then sent to the browser from the server. So you either need to set up a web server on your machine to test the perl code, or get some online hosting service where you can upload your files.


----------



## Hal356 (May 13, 2007)

Then is there a way that I am able to set up a Linux/Unix server in my house using a standard computer, so that I am able to execute the code to be able to see it? Or is there an easier way of doing this.

Please bear with me, as I am pretty much a newcomer to Perl, and how it works and everything.


----------



## JimmySeal (Sep 25, 2007)

Apache is a popular web server software package. It's free and runs on Unix and Windows. You could give that a try.
You could also join a free hosting service like www.tripod.com and upload your files there to test them.


----------

