Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
First, your use of ReadParse was a little over the top
Second when you want to print a block of html, use "s if you want to interpolate and 's if not.
Third, use strict and warnings.. They will give you a lot of answers on their own

The following works fine if the request is something like
http://foo.com/bar.cgi?baz=image.jpg
#!/usr/bin/perl -w use strict; my $Final; my $Good_Stuff; if ($ENV{'REQUEST_METHOD'} eq 'GET') { #Check to see which one it is $Good_Stuff = $ENV{'QUERY_STRING'}; #Split up the information } elsif ($ENV{'REQUEST_METHOD'} eq 'POST') { read(STDIN, $Good_Stuff, $ENV{'CONTENT_LENGTH'}); } ($Final) = split(/=/, $Good_Stuff,1); #Grab the filename $Final =~ s/%(..)/pack("c",hex($1))/ge; #Just for fun #Print out lots of stuff (this never works, though). print "Content-type: text/html\n\n"; print <<'ENDMETA'; <HTML><HEAD> <META NAME="GENERATOR" CONTENT="Adobe PageMill 3.0 Win"> <TITLE>Animetion Station &gt; Webcomic &gt; $Name</title> <LINK REL="stylesheet" HREF="Style.css" TYPE="text/css"> </head> ENDMETA print <<"ENDHTML"; <BODY> <P><CENTER> <DIV STYLE="background-color: #0099FF; font-family: Comic Sans MS; fon +t-size: 20px; width: 200px; color: white;"> Web Comics</div></center></p> <P> <TABLE WIDTH="757" BORDER="0" CELLSPACING="1" CELLPADDING="0" HEIGHT=" +294"> <TR> <TD WIDTH="14%" VALIGN="TOP" ALIGN="CENTER" HEIGHT="293"> <!--#include file="Sidebar.txt"--> </td> <TD WIDTH="86%" VALIGN="TOP" BGCOLOR="#3366ff"> <P><IMG SRC="$Final"></p> <P><IMG SRC="Images/Comic_Face.jpg" WIDTH="57" HEIGHT="54" ALIGN="BOTT +OM" BORDER="0" NATURALSIZEFLAG="3"> <IMG SRC="Images/Comic_Face2.jpg" WIDTH="60" HEIGHT="55" ALIGN="BOTTOM +" BORDER="0" NATURALSIZEFLAG="3"> <IMG SRC="Images/Comic_Face3.jpg" WIDTH="60" HEIGHT="62" ALIGN="BOTTOM +" BORDER="0" NATURALSIZEFLAG="3"> <IMG SRC="Images/Comic_Face4.jpg" WIDTH="60" HEIGHT="60" ALIGN="BOTTOM +" BORDER="0" NATURALSIZEFLAG="3"></td> </tr> </table> </body></html> ENDHTML

In reply to Re: Making webpages from a single CGI by Zecho
in thread Making webpages from a single CGI by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-19 06:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found