User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Perl section within the Software Development category of DaniWeb, a massive community of 455,972 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,808 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Perl advertiser: Programming Forums
Views: 835 | Replies: 3
Reply
Join Date: Nov 2007
Posts: 1
Reputation: dr_substance is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
dr_substance dr_substance is offline Offline
Newbie Poster

Question My first script is testing me....

  #1  
Nov 25th, 2007
'Ello, I'm Andrew & I have a very big problem. I'm learning Perl & I'm having problem with my first simple code. Every time I go to look @ the page it just comes up excluding the HTML tags. Here's the code 'firstscript.cgi':
#! /usr/bin/perl
print  "Content-type:text/html\n\n";

print  "<html><head><title>My First Script</title></head>\n\n";
print  "<body>\n";
print  "<p>Hello world!</p>\n";
print  "</body></html>";
& it's URL
I think it's
1) My Firefox Browser
2) The fact that I don't see the path to the shebang statement anywhere
Last edited by happygeek : Nov 27th, 2007 at 7:28 pm. Reason: url snipped - popup ads
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2006
Posts: 641
Reputation: KevinADC is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 36
KevinADC's Avatar
KevinADC KevinADC is offline Offline
Practically a Master Poster

Re: My first script is testing me....

  #2  
Nov 25th, 2007
If you are running the script as a CGI from a browser of course you will not see the html tags. You will see them in the source code,
Reply With Quote  
Join Date: Sep 2007
Location: North Bay Ontario
Posts: 176
Reputation: trudge is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 20
trudge trudge is offline Offline
Junior Poster

Re: My first script is testing me....

  #3  
Nov 26th, 2007
I'm going to go out on a limb and ask: are you viewing your page by just loading it into your browser?

Do you realize that with CGI scripts you have to access them through a web server? You would have to point your browser to '127.0.0.1/cgi-bin/your_script.pl' or wherever you have your web server configured to hold executables.

Do you have a web server running? This may seem like an obvious question, but if this is your first CGI script perhaps you may have missed that bit of crucial information.

Also please answer for us:

What OS are you running? Even though the shebang line indicates some flavour of Linux or UNIX, it doesn't matter in a Windows environment.

What exactly do you see when you view the page? I'm sorry but I won't be visiting the URL you posted.
Last edited by trudge : Nov 26th, 2007 at 3:24 pm.
Amer Neely - Web Mechanic
"Others make web sites. We make web sites work!"
Reply With Quote  
Join Date: Oct 2007
Posts: 302
Reputation: eggi is on a distinguished road 
Rep Power: 2
Solved Threads: 29
eggi eggi is offline Offline
Posting Whiz

Re: My first script is testing me....

  #4  
Dec 1st, 2007
If you see "Hello world!" in the browser when you pull up this page, then it's working fine. This isn't so much of a cgi script as a perl script that prints out html.

You won't see the #! perl line or any of the print statements. When you view source, you'll just see what you've printed.

I think you've got it right, just, maybe, unclear on what you're looking for

Best wishes,

, Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Perl Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Perl Forum

All times are GMT -4. The time now is 9:12 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC