Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: CGI.pm HTML shortcuts, Better Way?

by merlyn (Sage)
on Jun 06, 2001 at 18:21 UTC ( [id://86220]=note: print w/replies, xml ) Need Help??


in reply to CGI.pm HTML shortcuts, Better Way?

I was thinking that "maybe" I might start as a side project a module that would parse (at least the majority of..) well formed HTML and output the perl code to replicate the html using CGI.pm's shortcuts.
As a start, you could look at my column that does exactly that.

At the moment though, it outputs literally the shortcuts to generate exactly the same HTML, and doesn't recognize some of the higher-level form elements, like checkbox_group. Instead, you'll get all the individual input element calls. That's worthy of figuring out how to fix.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: Re: CGI.pm HTML shortcuts, Better Way?
by shotgunefx (Parson) on Jun 06, 2001 at 18:31 UTC
    Randal,

    Your the man. Seriously, your books, articles and since I've found Perlmonks, your posts, have been a huge help to me over the last couple years.

    Update

    Works great. I'll try and modify it to collect the options and print the perl for declaring the arrays and label_hashes. I notice it also doesn't like the new XML style CGI.pm output for non container tags. Should be easy to fix.

    Thanks Again.

    -Lee

    "To be civilized is to deny one's nature."
Re: Re: CGI.pm HTML shortcuts, Better Way?
by shotgunefx (Parson) on Jun 07, 2001 at 15:10 UTC
    I've got the <Select> and <option> tags fixed as well.

    (It's not pretty but it works) It took me awhile to wrap my head around the recursive nature of the code.

    Your code works great. I was able to take a 40 parameter form which is subtabled at least three levels and it worked perfectly. Also for kicks I grabbed a few pages off of Perlmonks and the script generated Perl output it back perfectly. It'll save me a lot of time.

    I'll probably add the creation of the %option_labels as well. It's a short jump from where it is. Nothing too crazy. (Don't think I'll bother checking for duplicate dissimilar params or anything.) When this is done would you mind if I posted it?

    -Lee

    "To be civilized is to deny one's nature."

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-20 02:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found