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

I was creating a table of URI encodings of ASCII characters as an appendix for my CGI course. Naturally, I figured that rather than create the table by hand, I'd write a script to do it, but I encountered an odd problem. Here's my code:
#!C:/perl/bin/perl.exe -w use strict; use URI::Escape; use CGI qw/:no_debug/; my $q = CGI->new(); my $file = "encodeTable.html"; my $outdata = ""; open OUT, ">$file" or die "Cannot open $file: $!\n"; for ( 0 .. 255 ) { my $char = chr( $_ ); my $escaped = uri_escape( $char ); unless ( $escaped ne '%20' ) { $escaped .= ' or +' }; $outdata .= $q->Tr( $q->td( { -align => 'right' }, [ $_ < 33 ? '&nbsp;' : $char, $_ , $e +scaped ] ) ); } print OUT $q->start_html( -title => "Uri Character Codes", -style => { src => '../style.css' }, -author=> 'poec@yahoo.com' ), $q->table( { -border => 1 }, $q->Tr ( $q->th( [ 'Symbol', 'ASCII Value', 'URI +encoded' ] ) ), $outdata ), $q->end_html; close OUT;
Now the above code works just fine. Unfortunately, all of the HTML runs together in one big line (which is fine if I'm conserving bandwidth). However, I decided to change the use CGI qw/:no_debug/; line to use CGI::Pretty qw/:no_debug/; and discovered that with this one simple change, the <TD ALIGN="right"> and the <TABLE BORDER="1"> tags have their attributes stripped, thus changing the appearance of the table. Searching through the POD has proved fruitless. Does CGI::Pretty strip attributes deliberately? Is this a known bug?

I'm using CGI.pm version 2.74 and CGI::Pretty version 1.04. Both of these appear to be the most up-to-date versions. If I am missing something, please let me know!

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just go the the link and check out our stats.

Replies are listed 'Best First'.
Re: Bug in CGI::Pretty?
by merlyn (Sage) on Oct 29, 2000 at 05:39 UTC
Re: Bug in CGI::Pretty?
by mitd (Curate) on Oct 29, 2000 at 22:06 UTC
    Just happen to playing with CGI::Pretty myself, so I grabbed your code and ran it.

    I observed no difference in output except for beautifying CGI::Pretty is supposed to do.

    the only difference is I am running Linux and you appear to be on MS.

    I won't clutter up this sapce with output but I would be happy to send.

    MitD -- Made in the Dark
    'My favourite colour appears to be grey.'