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

Re^3: How to make that works with perl

by Thilosophy (Curate)
on Apr 14, 2007 at 01:55 UTC ( #610031=note: print w/replies, xml ) Need Help??

in reply to Re^2: How to make that works with perl
in thread How to make that works with perl

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++

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://610031]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2022-05-28 08:55 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (99 votes). Check out past polls.