Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Generating HTML- - CGI::Simple

by cosmicperl (Chaplain)
on Mar 10, 2009 at 20:41 UTC ( [id://749720]=perlquestion: print w/replies, xml ) Need Help??

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

Hi All,
  I'm working on a new plugin for CGI::Application. It generates HTML forms based on a HTML::Template file, but creating each input field from YAML schema.

At the moment I'm using to generate the input fields. The problem is I know a lot of people use CGI::Simple with CGI::Application so the HTML generation isn't always available.

I've considered an option of using HTML::Template::Set to get sample input field HTML into the script. But I also want the option to be able to just define some styles in the YAML and generate the input field HTML from the script.

I read a lot of people saying never use to generate HTML, so what is the alternative? Should I just roll my own HTML? Or is there another module I should be using?


Update: Just found HTML::EasyTags which is perfect!

Replies are listed 'Best First'.
Re: Generating HTML- - CGI::Simple
by wfsp (Abbot) on Mar 11, 2009 at 07:59 UTC
    I use CGI::Application with CGI::Simple and HTML::Template and I find it works very well.

    I may be missing something but couldn't you combine the two?

    my $t = HTML::Template->new(filename => q{tmpl.html}); $t->param( input_field => get_input_field(), ); print $t->output; sub get_input_field{ # do something with YAML }
    <html> ... <TMPL_VAR input_field> ... </html>
      That's what I'm doing :) Just that in your example get_input_field would load the YAML then use to make the input field.

      I think I'll just roll my own unless I come across something lightweight on CPAN.


Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (1)
As of 2024-05-23 16:40 GMT
Find Nodes?
    Voting Booth?

    No recent polls found