Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
One technique I often used is a simple HTML template with data tags wrapped inside %% quotes. Simple and effective.
#!/usr/bin/perl -w use strict; use CGI; # Initialize CGI variable my $q = new CGI; # Load HTML my $html; { local $/; $html = <DATA>; } # Format HTML using data callbacks $html =~ s/%%(\w+)%%/&FormatHTML($1)/ge; # Display the HTML print $q->header, $html; exit(0); sub FormatHTML() { my $tag = shift; if ($tag eq "TITLE") { return &FormatTitle(); } elsif ($tag eq "TOC") { return &FormatToc(); } elsif ($tag eq "BODY") { return &FormatBody(); } } sub FormatTitle() { return "HTML Sample"; } sub FormatToc() { return "<b>Table of Contents</b><br>"; } sub FormatBody() { return "<i>Sample text</i>"; } __DATA__ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <html xmlns=""> <head> <title>%%TITLE%%</title> </head> <body> %%TOC%% %%BODY%% </body> </html>

In reply to Re: Web app frameworks - I am totally confused! by Roger
in thread Web app frameworks - I am totally confused! by jdtoronto

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 or How to display code and escape characters are good places to start.
Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2021-06-20 03:57 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (94 votes). Check out past polls.