Ovid has asked for the wisdom of the Perl Monks concerning the following question:
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?#!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 ? ' ' : $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;
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 |