From: "Pradeep Goel" <[EMAIL PROTECTED]>
> > Why don't you generate it in HTML then???
> 
> I don't have a good idea about that - can you give some pointers for
> this ?

HTML is just text with some markup inside. You can easily generate it 
by print statements like

        print <<"*END*";
        <html>
        <head><title>$title</title></head>
        <body>
        <h1>$title</h1>
        <p align=center>$first_paragraph</p>
        ...
        *END*

Or you can use any of the HTML templating modules from CPAN. (Well 
maybe no any, some might assume you use them via CGI and want to send 
the results back to the user directly.
Most probably they'd be a little overkill anyway.

Just one thing ... if the variables you want to insert into the HTML 
may contain any special characters (like <, > or &) you need to 
escape them:

        $title = HTML::Entities::encode($title, '^\r\n\t !\#\$%\"\'-;=?-~');

One nice solution would be to use Interpolation (from CPAN):

        use Interpolation
                '=' => 'htmlescape',
                '"' => sub {'"' . $Interpolation::builtin{'tagescape'}->($_[0]) };
        
        print <<"*END*";
        <html>
        <head><title>$={$title}</title></head>
        <body>
        <h1>$title</h1>
        <p align=center>$={$first_paragraph}</p>
        <form><input type=hidden name=Foo value=$"{$Foo}">
        ...
        *END*
        
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to