Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

How to make that works with perl

by adam_blackice (Acolyte)
on Apr 14, 2007 at 00:38 UTC ( [id://610022]=perlquestion: print w/replies, xml ) Need Help??

adam_blackice has asked for the wisdom of the Perl Monks concerning the following question:

hello all

i want to make the form of the cgi to be more modest
so i use dreamwaver to make some effects to my page
itis asimple page has three text fields and it takes the action from another script
how can i configure that to work with perl ?
the code
<HTML> <HEAD> <TITLE>index</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1 +"> </HEAD> <BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEI +GHT=0> <!-- ImageReady Slices (index.psd) --> <TABLE WIDTH=766 BORDER=0 align="center" CELLPADDING=0 CELLSPACING=0> <TR valign="top"> <TD COLSPAN=3> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-4445 +53540000" codebase="http://download.macromedia.com/pub/shockwave/cabs +/flash/swflash.cab#version=6,0,29,0" width="766" height="485"> <param name="movie" value="banner.swf"> <param name="quality" value="high"> <embed src="banner.swf" quality="high" pluginspage="http://www +.macromedia.com/go/getflashplayer" type="application/x-shockwave-flas +h" width="766" height="485"></embed></object></TD> </TR> <TR> <TD> <IMG SRC="images/index_02.jpg" WIDTH=256 HEIGHT=257 ALT="" +></TD> <TD width="414" height="50" valign="top" background="images/index_ +03.jpg"> <table width="100%" border="0" bordercolor="#006699"> <tr> <td height="30"><font face="Arial, Helvetica, sans-serif"><s +trong><font size=5 color='#00000'> <marquee> </marquee> </font> <font size=5 color='#00000'> <marquee> </marquee> </font> <font size=5 color='#00000'> <marquee> <font color="#006699" size="2"><font color="#CC3300">@</fo +nt>&nbsp;&nbsp;welcome to registration page&nbsp;&nbsp;@&nbsp;<font color="#CC330 +0">&nbsp;engy with anather services</font></font> </marquee> </font> </strong> </font></td> </tr> </table> <strong></strong> <form action='action1.pl' method='post'> <font size="-7">&nbsp;<font face="Arial, Helvetica, sans-serif +">Neam</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n +bsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type='text' name='name' size='35'> <br> &nbsp;<font face="Arial, Helvetica, sans-serif">Email</font>&n +bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp +;&nbsp; &nbsp; <input type='text' name='email' size='35'> <br> &nbsp;<font face="Arial, Helvetica, sans-serif">Userneam</font +></font>&nbsp;&nbsp; &nbsp; <input type='password' name='password' size='35'> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n +bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp +;&nbsp;&nbsp; <input name="submit" type='submit' value='Submit'> </form> </TD> <TD> <IMG SRC="images/index_04.jpg" WIDTH=96 HEIGHT=257 ALT=""> +</TD> </TR> <TR> <TD COLSPAN=3> <IMG SRC="images/index_05.jpg" WIDTH=766 HEIGHT=65 ALT=""> +</TD> </TR> </TABLE> <!-- End ImageReady Slices --> </BODY> </HTML>

Replies are listed 'Best First'.
Re: How to make that works with perl
by Thilosophy (Curate) on Apr 14, 2007 at 00:48 UTC
    Not sure what you mean, but if you want to make your Perl CGI script output HTML that contains only very little dynamic content ("takes the action from another script" ?) and is mostly created by Dreamweaver you should use one of the popular templating engines (such as Template Toolkit or HTML::Template).

    If you have some extra time and control over how the HTML design is done, you should also consider switching over to standards-based design using CSS. That would greatly simplify the HTML that your program has to produce (no more tables, font tags, or nbsps) and make it easier to change the design without touching the program or templates.

      thanx for your replay
      i want to make a dynamic content like a flash banner and adding effects to the page and itis code is indicates above
      that code be possible ?
      what is HTML::Template?
        You want to serve a page that looks like your DreamWeaver page from a CGI/Perl script.

        How the page looks in a web browser depends only on the HTML of that page. It does not matter at all how that HTML was produced on the server-side: It does not matter if it is hand-written in vi, done with DreamWeaver or by print statements in a Perl program. It does not matter if it is static HTML, or made by Perl, Java, COBOL, ASP .

        So, yes, of course, you can write a Perl program that outputs HTML that looks exactly like your DreamWeaver file. The easiest way is to use a templating engine (HTML::Template is one such, just search for it on CPAN or here).

        When you say "dynamic content" you have to distinguish between dynamic for the client, and dynamic for the server. Your flash banner is probably not dynamic content in terms of the server. What I mean is that the HTML (the part that the server produces) will always say src="banner.swf" , which is completely static. If the DreamWeaver page you made (which is static, because it is a static HTML file) already has all the dynamic content you want, you do not need to change that HTML dynamically on the server.

        Examples for server-side dynamic content would be error messages (like "wrong password") that get inserted in the form, or rotating to a different flash banner depending on some clever conditions (although this can usually also be done on the client-side with JavaScript, or by the banner server).

        I hope this is not too confusing for you. If this is your first project with Perl/CGI, I highly recommend you look at some of the tutorials here on PerlMonks. The most important concept to get a handle on IMHO is between what has to happen on the server, and what happens in the web browser. Separating these two parts cleanly can greatly improve maintainability of your application.

        Update: fix CPAN link, GrandFather++

Re: How to make that works with perl
by GrandFather (Saint) on Apr 14, 2007 at 01:02 UTC

    Not sure what you mean. But if you want to see what action1.pl might look like then here's a start:

    #!Perl -w use strict; use CGI::Pretty qw(:standard :cgi-lib); use CGI::Carp qw(fatalsToBrowser); # Remove for production code $| = 1; # Unbuffered output if (param('submit')) { print header (); my $name = param ('name'); my $email = param ('email'); my $password = param ('password'); print "Name: $name<br/>\n"; print "Email: $email<br/>\n"; print "Password: $password<br/>\n"; } exit 0;

    Generates:

    Name: wibble wobble<br/> Email: wibble@wobble<br/> Password: wibble<br/>

    See CGI and the Tutorials' Web Programming for more information.


    DWIM is Perl's answer to Gödel
      use CGI::Pretty qw(:standard :cgi-lib);

      Why :cgi-lib?

      $| = 1; # Unbuffered output

      Why force separate network packets for each of the four prints?

        Sigh. Cargo cult copy and paste from other code. :( Probably made sense in the other context, but not here.


        DWIM is Perl's answer to Gödel
      use CGI::Carp qw(fatalsToBrowser); # Remove for production code

      I don't, unless I put more sophisticated error handling for end users on the browser. It may confused them but they still have a chance to copy paste what shown and hopefully send it to the appropriate person, instead of merely 500 Internal Server Error. End users don't have access to error.log.


      Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!

        Potential black hats don't have access to the error logs either. Leaving development error output may let out something you don't want being leaked to potential attackers. Set up your web server to send an innocuous error page and leave the detailed errors for the developers' eyes only.l

Re: How to make that works with perl
by CountZero (Bishop) on Apr 14, 2007 at 22:31 UTC
    It is proven once more: Dreamweaver writes ugly HTML.

    What use is something like <strong></strong> or <marquee></marquee>? Or all the &nbsp;? Or the strange mixture of uppercase and lowercase tags? And no CSS but tables to format your page. And it does not even state against which version of HTML is it written. Even a simple and free program as Nvu knows how to do that.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://610022]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-03-29 14:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found