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

I've been mucking around with CGI.pm recently and I keep having strange problems. The first was that CGI::Pretty ended up generating html that was impossible to distinguish from that generated by the standard CGI module. Is there something beyond "use CGI::Pretty" required to get this module to do anything?

Currently I'm looking at the start_table. This works but doesn't seem to recognize attributes (such as -align=>'center', -border=>0, -cellpadding=>8) recognized by the  <table> tag. I went ahead and upgraded to the latest CGI.pm - still no luck. Should just look like  start_table(-align=>'center', -border=>0, -cellpadding=>8) right? Am I missing something obvious? Many thanks.

Replies are listed 'Best First'.
Re: CGI irregularities
by rev_1318 (Chaplain) on Mar 09, 2005 at 10:30 UTC
    start_table takes it's attributes as a hash-ref, so try
    start_table({-align=>'center', -border=>0, -cellpadding=>8})
    That should work

    Paul

Re: CGI irregularities
by PodMaster (Abbot) on Mar 09, 2005 at 07:22 UTC
    C:\>perl -MCGI -e"die CGI->start_table({1..10})" <table 1="2" 3="4" 7="8" 9="10" 5="6"> at -e line 1.

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re: CGI irregularities
by chas (Priest) on Mar 09, 2005 at 06:39 UTC
    I thought start_table() just produced a <table> tag. The various attributes go in table() rather than start_table() (unless things have changed in recent versions.)
    chas
    (Update: I guess I was mistaken; the attributes can also be put in start_table(); I just never did that. But as has already been noted, they have to be in a hashref.)