--- Sally <[EMAIL PROTECTED]> wrote:
> I got the following code from a tutorial.

Are you sure you got all of it?
I see a lot of bare HTML, which should send the Perl parser into
predictable spasms even *without* strict (but use strict!!!).

> When I uploaded (FTP) it as a perl
> file I got more errors than you could shake a stick at. When I
> uploaded it
> as an html file it sort of worked, ie it printed out the "Hello
> world" but
> it printed out everything else too. I think I understand why it
> worked as
> html, but I don't understand why it didn't work as perl. Any
> suggestions
> would be appreciated, and if you were the one who wrote this code on
> the
> tutorial, please can you offer suggestions as to why code may fail.
> 
> #!/usr/bin/perl -wT
> 
> use strict;
> 
> &error;

Reading the code below, this is as far as the program would get even if
it *weren't* for the bare HTML!

Where did you get this? =o)

(And Taint checking, too.....)
 
> #hellocgi
> 
> print "Content-type: text/html\n\n";
> 
> &error;
> 
> <HTML>
> 
> &error;
> 
> <HEAD>
> <TITLE>Hello, world!</TITLE>
> </HEAD>
> 
> &error;
> 
> <BODY>
> <H1>Hello, world!</H1>
> </BODY>
> 
> &error;
> 
> </HTML>
> 
> 
> sub error {
>     my( $q, $error_message ) = @_;
> 
>     print $q->header( "text/html" ),
>           $q->start_html( "Error" ),
>           $q->h1( "Error" ),
>           $q->p( "Sorry, the following error has occurred: " );
>           $q->p( $q->i( $error_message ) ),
>           $q->end_html;
>     exit;
> }
> 


=====
print "Just another Perl Hacker\n"; # edited for readability =o)
=============================================================
Real friends are those whom, when you inconvenience them, are bothered less by it than 
you are. -- me. =o) 
=============================================================
"There are trivial truths and there are great Truths.
 The opposite of a trival truth is obviously false.
 The opposite of a great Truth is also true."  -- Neils Bohr

__________________________________________________
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/

Reply via email to