CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Im Very Very New To CGI/Perl

 



SaiyanM
User

Jan 22, 2001, 2:28 PM

Post #1 of 10 (1286 views)
Im Very Very New To CGI/Perl Can't Post

Someone please help me with this Perl file I wrote. It's a META Generator and something is wrong with it. I get a 500 Internal Server Error. PLEASE HELp. Here is the code...


#!/usr/local/bin/perl
#########################
#The META Tag Generator #
#feel free to distribute this as you wish #
#as long this message stays in tact #
#YOU CANNOT SELL IT #
#ChibiGuy Productions 2000-20001 #
#########################

$meta_keywords = values{"keywords"};
$meta_description = values{"description"};
$meta_name = values{"name"};
$meta_generator = values{"generator"};
$meta_copyright = values{"copyright"};

print "Content-type:text/html\n\n";
print <<END;
<font size="1" face="tahoma" color="black"><b>Here are your META Tags </b>... insert them in your <head> section of your page<bR>

<textarea>
<META NAME="KEYWORDS" CONTENT="$meta_keywords">
<META NAME="DESCRIPTION" CONTENT="$meta_description">
<META NAME="NAME" CONTENT="$meta_name">
<META NAME="GENERATOR" CONTENT="$meta_generator">
<META NAME="COPYRIGHT" CONTENT="$meta_copyright">
</textarea>





To add this script to your site use this code



<form action="http://saiyanh.virtualave.net/cgi-bin/metagenerator.cgi" method="post">

Keywords- <input type="text" name="keywords">


Description- <input type="text" name="description">


The Name of Your Website- <input type="text" name="name">


What you use to write HTML- <input type="text" name="generator">


The copyright of your website- <input type="text" name="copyright">


<center><input type="submit" value="Generate Codes"><input type="reset" value="start over">

</form>
END








sleuth
Enthusiast

Jan 22, 2001, 6:58 PM

Post #2 of 10 (1283 views)
Re: Im Very Very New To CGI/Perl [In reply to] Can't Post

 
$meta_copyright = values{"copyright"};

Is your problem, values doesn't exist, perl doesn't have a built in ability to read a forms data, you have to do that your self. The best way is to do this.

use CGI qw:/standard/;
$meta_copyright = param('copyright');

Make sure to change the other ones too, not just the above one, you only need one "use CGI qw:/standard/;" and it has to be above your calls for param('');, so place it right under the first line.

Tony



SaiyanM
User

Jan 23, 2001, 2:51 PM

Post #3 of 10 (1263 views)
Re: Im Very Very New To CGI/Perl [In reply to] Can't Post

I tried doing that, but I still get a 500 Internal Server Error. My host's error log says that there is something wrong with the use of "use CGI qw:/standard/;". Here is the file, please look it over and tell me exactly waht is wrong.


#!/usr/local/bin/perl
#########################
#The META Tag Generator #
#feel free to distribute this as you wish #
#as long this message stays in tact #
#YOU CANNOT SELL IT #
#ChibiGuy Productions 2000-20001 #
#########################

use CGI qw:/standard/;
$meta_copyright = param('copyright');
$meta_keywords = param('keywords');
$meta_description = param('description');
$meta_name = param('name');
$meta_generator = param('generator');
$meta_copyright = param('copyright');


print <<END;
<font size="1" face="tahoma" color="black"><b>Here are your META Tags </b>... insert them in your <head> section of your page<bR>

<textarea>
<META NAME="KEYWORDS" CONTENT="$meta_keywords">
<META NAME="DESCRIPTION" CONTENT="$meta_description">
<META NAME="NAME" CONTENT="$meta_name">
<META NAME="GENERATOR" CONTENT="$meta_generator">
<META NAME="COPYRIGHT" CONTENT="$meta_copyright">
</textarea>





To add this script to your site use this code



<form action="http://saiyanh.virtualave.net/cgi-bin/metagenerator.cgi" method="post">\n
Keywords- <input type="text" name="keywords">
\n
Description- <input type="text" name="description">
\n
The Name of Your Website- <input type="text" name="name">
\n
What you use to write HTML- <input type="text" name="generator">
\n
The copyright of your website- <input type="text" name="copyright">
\n
<center><input type="submit" value="Generate Codes"><input type="reset" value="start over">\n
</form>
END










modified
Deleted

Jan 23, 2001, 3:07 PM

Post #4 of 10 (1262 views)
Re: Im Very Very New To CGI/Perl [In reply to] Can't Post

Try changing

print <<END;

to:

print qq~

And change:

END

to:

~;

And get rid of all the \n things in the HTML code.



SaiyanM
User

Jan 23, 2001, 3:18 PM

Post #5 of 10 (1261 views)
Re: Im Very Very New To CGI/Perl [In reply to] Can't Post

Nope, that still didnt work. This is the error message I get "Can't find string terminator ":" anywhere before EOF at metagenerator.pl line 10". And here is the file...


#!/usr/local/bin/perl
#########################
#The META Tag Generator #
#feel free to distribute this as you wish #
#as long this message stays in tact #
#YOU CANNOT SELL IT #
#ChibiGuy Productions 2000-20001 #
#########################

use CGI qw:/standard/;
$meta_copyright = param('copyright');
$meta_keywords = param('keywords');
$meta_description = param('description');
$meta_name = param('name');
$meta_generator = param('generator');
$meta_copyright = param('copyright');

print qq~
<font size="1" face="tahoma" color="black"><b>Here are your META Tags </b>... insert them in your <head> section of your page<bR>

<textarea>
<META NAME="KEYWORDS" CONTENT="$meta_keywords">
<META NAME="DESCRIPTION" CONTENT="$meta_description">
<META NAME="NAME" CONTENT="$meta_name">
<META NAME="GENERATOR" CONTENT="$meta_generator">
<META NAME="COPYRIGHT" CONTENT="$meta_copyright">
</textarea>





To add this script to your site use this code




~;












japhy
Enthusiast

Jan 23, 2001, 3:40 PM

Post #6 of 10 (1256 views)
Re: Im Very Very New To CGI/Perl [In reply to] Can't Post

That's because you have qw:/standard/ instead of qw/:standard/. modified pasted that in incorrectly.

Jeff "japhy" Pinyan -- accomplished hacker, teacher, lecturer, and author


SaiyanM
User

Jan 23, 2001, 3:53 PM

Post #7 of 10 (1252 views)
Re: Im Very Very New To CGI/Perl [In reply to] Can't Post

damn, that didn't even work. I STILL get a 500 Internal Server Error. Here is the file again...


#!/usr/local/bin/perl
#########################
#The META Tag Generator #
#feel free to distribute this as you wish #
#as long this message stays in tact #
#YOU CANNOT SELL IT #
#ChibiGuy Productions 2000-20001 #
#########################

use CGI qw/:standard/;
$meta_copyright = param('copyright');
$meta_keywords = param('keywords');
$meta_description = param('description');
$meta_name = param('name');
$meta_generator = param('generator');
$meta_copyright = param('copyright');

print <<EOF
<font size="1" face="tahoma" color="black"><b>Here are your META Tags </b>... insert them in your <head> section of your page<bR>

<textarea>
<META NAME="KEYWORDS" CONTENT="$meta_keywords">
<META NAME="DESCRIPTION" CONTENT="$meta_description">
<META NAME="NAME" CONTENT="$meta_name">
<META NAME="GENERATOR" CONTENT="$meta_generator">
<META NAME="COPYRIGHT" CONTENT="$meta_copyright">
</textarea>





To add this script to your site use this code




EOF












modified
Deleted

Jan 23, 2001, 4:30 PM

Post #8 of 10 (1250 views)
Re: Im Very Very New To CGI/Perl [In reply to] Can't Post

Add a ; after print <<EOF;



SaiyanM
User

Jan 23, 2001, 4:39 PM

Post #9 of 10 (1249 views)
Re: Im Very Very New To CGI/Perl [In reply to] Can't Post

Thanks, Ill try it

(This post was edited by SaiyanM on Jan 23, 2001, 3:54 PM)


pu_nk
journeyman

Jan 23, 2001, 5:59 PM

Post #10 of 10 (1244 views)
Re: Im Very Very New To CGI/Perl [In reply to] Can't Post

I was reading these post and here is something i made that may save you hours in the end..

If you are using Perl Builder to edit your programs add this code to your Script Manager and run it when you need to....

Or if you dont use Perl builder just run all your HTML code through this and you will always have flawless, clean, easy to read HTML

Here is the code...
-----------------------------------------------------
$_=~s/ //g;
$_ =~ s/"/\\"/g;
$_=~s/\n//g;
$_=~s/\n\n//g;
$_=~s/@/\\@/g;


print "print \"$_\\n\";\n";

---------------------------------------------------

Try it,.. you may like it..

Drew



 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives