#!D:\perl\5.8.2\bin\perl.exe -w
sub
TIEHANDLE {
my
(
$class
,
$var
) =
@_
;
return
bless
{
var
=>
$var
},
$class
;
}
sub
PRINT {
my
(
$self
) =
shift
;
${
'main::'
.
$self
->{var}} .=
join
''
,
@_
;
}
sub
OPEN {}
sub
CLOSE {}
sub
READ {}
sub
READLINE {}
sub
GETC {}
my
$Original_File
=
'lib\Test\HTML\Content.pm'
;
$SIG
{__WARN__} =
sub
{
$main::_STDERR_
.=
join
''
,
@_
; };
tie
*STDOUT
,
'Catch'
,
'_STDOUT_'
or
die
$!;
tie
*STDERR
,
'Catch'
,
'_STDERR_'
or
die
$!;
undef
$main::_STDOUT_
;
undef
$main::_STDERR_
;
eval
q{
my $example = sub {
local $^W = 0;
#line 598 lib/Test/HTML/Content.pm
$HTML = "<html><title>A test page</title><body><p>Home page</p>
<!--Hidden message--></body></html>";
link_ok($HTML,qr"http://[a-z]+\.perl.com","We have a link to perl.com");
title_count($HTML,1,"We have one title tag");
title_ok($HTML,qr/test/);
"We have an image of a camel on the page"
);
"In fact, we have exactly two camel images on the page"
);
no_tag(
$HTML
,
"blink"
,{},
"No annoying blink tags ..."
);
text_ok(
$HTML
,
"Perl"
);
comment_ok(
$HTML
,
"Hidden message"
);
no_tag(
$HTML
,
"p"
,{
style
=>
qr'ugly$'
},
"No ugly styles"
);
comment_ok(
$HTML
,
qr"[hH]idden\s+mess"
);
xpath_ok(
$HTML
,
'/html/body/p'
,
'HTML is somewhat wellformed'
);
no_xpath(
$HTML
,
'/html/head/p'
,
'HTML is somewhat wellformed'
);
;
}
};
is($@,
''
,
"example from line 598"
);
undef
$main::_STDOUT_
;
undef
$main::_STDERR_
;