$loaded = 1;
ok 1;
BEGIN {
$| = 1;
if ( $] > 5.006 ) {
# no utf8
require utf8; # we contain Latin-1
}
}
######################### End of black magic.
my $CRLF = "\015\012";
}
}
# util
sub test {
local ($^W) = 0;
}
# all the automatic tags
'<h1 align="CENTER">fred</h1> <h1 align="CENTER">agnes</h1>',
"distributive tag with attribute";
{
local $" = '-';
is h1( 'fred', 'agnes', 'maura' ), '<h1>fred-agnes-maura</h1>',
}
# return to normal
charset( 'ISO-8859-1' );
like header( -nph => 1 ),
qr!HTTP/1.0 200 OK${CRLF}Server: cmdline${CRLF}Date:.+${CRLF}Content-Type: text/html; charset=ISO-8859-1${CRLF}${CRLF}!,
<!DOCTYPE html
<head>
<title>Untitled Document</title>
</head>
<body>
END
is start_html(
-Title => 'The world of foo' ,
-Script => [ {-src=> 'foo.js', -charset=>'utf-8'} ],
<!DOCTYPE html
<head>
<title>The world of foo</title>
</head>
<body>
END
for my $v (qw/ 2.0 3.2 4.0 4.01 /) {
local $CGI::XHTML = 1;
is
<!DOCTYPE html
</head>
<body>
END
}
is
<!DOCTYPE html
<head>
<title>Untitled Document</title>
</head>
<body>
END
my $cookie =
cookie( -name => 'fred', -value => [ 'chocolate', 'chip' ], -path => '/' );
my $h = header( -Cookie => $cookie );
like $h,
qr!^Set-Cookie: fred=chocolate&chip\; path=/${CRLF}Date:.*${CRLF}Content-Type: text/html; charset=ISO-8859-1${CRLF}${CRLF}!s,
is start_h3, '<h3>';
is end_h3, '</h3>';
is start_table( { -border => undef } ), '<table border>';
'<h1>this is <not> ‹right›</h1>';
charset('utf-8');
ord("\t") == 9
? '<h1>this is <not> �right�</h1>'
: '<h1>this is <not> �right�</h1>';
is i( p('hello there') ), '<i><p>hello there</p></i>';
my $q = CGI->new;
is $q->h1('hi'), '<h1>hi</h1>';
$q->autoEscape(1);
$q->autoEscape(0);