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

Hi, how do I print the following via CGI.PM -
<a href="http://www.web.com"><img src="/web.gif"></a>

Replies are listed 'Best First'.
Re: image and href tags in CGI.pm
by mpeters (Chaplain) on Jan 03, 2005 at 20:29 UTC
    print a({href => "http://www.web.com"} ,img({src=>'/web.gif'}));

    But honestly doesn't that seem like more work than just printing it?
      But honestly doesn't that seem like more work than just printing it?
      Yes, it does. And to the original poster, please don't use CGI.pm to generate HTML. It's a horrible, horrible sin against humanity. Not only do you have the usual flaws of embedding the html(presentation) in your code(control), you don't even make the html in an easily recognizable form. It's in some bizarre CGI.pm language which is a pain in the ass to find.

        I wonder what's worse. Some guy writing code the way he wants (using CGI.pm) or some (HTML::)Template( Toolkit) zealot...

        Your reaction is nothing but a Pavlovian reaction. Instead of explaining what is wrong with producing CGI.pm HTML in a normal way, you try to make the OP look bad for even talking about CGI.pm. You don't know anything about the project (s)he's working on, so you can't tell wheter using CGI.pm is really a bad choice.

        Just because you think(/read that) using CGI.pm for HTML creation is bad, doesn't mean that others can't be happy with it.

        Please, please give some more structured criticism instead of this zealotry.

        --
        b10m

        All code is usually tested, but rarely trusted.

        Hi,

        I politely disagree with your comment about CGI.pm. It is actually quite easy to use with a moderate learning curve. Whether or not to use a template is mostly by design of the project and personal preferences. Each has their uses.

        Jason L. Froebe

        Team Sybase member

        No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1