[LDS - Mon Aug 18 13:58:25 2003]:
Show quoted text> I believe this was fixed in 2.99 and in 3.00
Bug still present. Included is a patch that adds test file
t/start_html.t and patches CGI.pm so that it behaves as documented with
start_html( -style => $css )'s old behaviour.
Where was this bug introduced? I tested start_html.t with versions 2.91
- 3.00. Here are the results:
2.91 ok
2.92 ok
2.93 ok
2.94 ok
2.95 not ok
t/start_html....CGI::_style: In string, @other now must be written as
\@other at t/start_html.t line 7
# Looks like your test died before it could output anything.
t/start_html....dubious
Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 1-3
2.96 not ok (as above)
2.97 not ok
bug introduced
t/start_html....Use of uninitialized value in concatenation (.) at
(eval 6) line 37.
t/start_html....NOK 1# Failed test (t/start_html.t at line 7)
# '<?xml version="1.0" encoding="iso-8859-1"?>
# <!DOCTYPE html
# PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
# "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
# <html xmlns="
http://www.w3.org/1999/xhtml" lang="en-US"
xml:lang="en-US"><head><title>Untitled Document</title>
# <link rel="stylesheet" type="text/css" href="BODY { background-color:
blue; }" />
# </head><body>'
# doesn't match '(?-xism:<style type="text/css">\s?<!--/\*
<!\[CDATA\[ \*/\s?BODY { background-color: blue ; })'
t/start_html....ok 3/3# Looks like you failed 1 tests of 3.
t/start_html....dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 1
Failed 1/3 tests, 66.67% okay
2.98 not ok (as above)
2.99 not ok (as above)
3.00 not ok (as above)
---
So it looks like there are two bugs, the first introduced in 2.94 (and
mentioned in the Changelog), and this one; introduced in 2.97. As
promised, here's a patch. This is also available at
http://keroes.com/perl/CGI.pm-3.00_01.patch .
__BEGIN__
diff -Pru CGI.pm-3.00/CGI.pm CGI.pm-3.00_01/CGI.pm
--- CGI.pm-3.00/CGI.pm Mon Aug 18 10:44:24 2003
+++ CGI.pm-3.00_01/CGI.pm Mon Aug 18 11:51:36 2003
@@ -19,7 +19,7 @@
#
http://stein.cshl.org/WWW/software/CGI/
$CGI::revision = '$Id: CGI.pm,v 1.130 2003/08/01 14:39:17 lstein Exp $
+ patches by merlyn';
-$CGI::VERSION='3.00';
+$CGI::VERSION='3.00_01';
# HARD-CODED LOCATION FOR FILE UPLOAD TEMPORARY FILES.
# UNCOMMENT THIS ONLY IF YOU KNOW WHAT YOU'RE DOING.
@@ -1532,12 +1532,11 @@
}
if ($verbatim) {
push(@result, "<style type=\"text/css\">\n$verbatim\n</style>");
- }
+ }
push(@result,style({'type'=>$type},"$cdata_start\n$code\n$cdata_end"))
if $code;
} else {
my $src = $style;
- push(@result,$XHTML ? qq(<link rel="stylesheet" type="$type"
href="$src" $other/>)
- : qq(<link rel="stylesheet" type="$type"
href="$src"$other>));
+ push(@result, "<style type=\"text/css\">\n$src\n</style>");
}
@result;
}
diff -Pru CGI.pm-3.00/MANIFEST CGI.pm-3.00_01/MANIFEST
--- CGI.pm-3.00/MANIFEST Mon Apr 14 11:26:11 2003
+++ CGI.pm-3.00_01/MANIFEST Mon Aug 18 11:54:44 2003
@@ -51,3 +51,4 @@
t/switch.t
t/util.t
t/util-58.t
+t/start_html.t
diff -Pru CGI.pm-3.00/t/start_html.t CGI.pm-3.00_01/t/start_html.t
--- CGI.pm-3.00/t/start_html.t Wed Dec 31 16:00:00 1969
+++ CGI.pm-3.00_01/t/start_html.t Mon Aug 18 12:09:37 2003
@@ -0,0 +1,17 @@
+use Test::More tests => 3;
+
+use CGI qw/start_html/;
+
+$css = 'BODY { background-color: blue; }';
+
+like start_html( -style => $css ),
+ qr|<style type="text/css">\s?<!--/\* <!\[CDATA\[ \*/\s?BODY {
background-color: blue; }|,
+ 'start_html( -style => $css )';
+
+like start_html( -style => { -verbatim => $css } ),
+ qr|<style type="text/css">\s?BODY { background-color: blue; }|,
+ 'start_html( -style => { -code => $css } )';
+
+like start_html( -style => { -code => $css } ),
+ qr|<style type="text/css">\s?<!--/\* <!\[CDATA\[ \*/\s?BODY {
background-color: blue; }|,
+ 'start_html( -style => { -code => $css } )';