120 |
} |
} |
121 |
print STDOUT Encode::encode ('utf-8', $$out); |
print STDOUT Encode::encode ('utf-8', $$out); |
122 |
print STDOUT "\n"; |
print STDOUT "\n"; |
123 |
|
} elsif (@mode == 3 and $mode[0] eq 'h2h' and $mode[1] eq '' and |
124 |
|
($mode[2] eq 'html' or $mode[2] eq 'test')) { |
125 |
|
print STDOUT "Content-Type: text/plain; charset=utf-8\n\n"; |
126 |
|
|
127 |
|
require Encode; |
128 |
|
$time1 = time; |
129 |
|
$s = Encode::decode ('utf-8', $s); |
130 |
|
$time2 = time; |
131 |
|
$time{decode} = $time2 - $time1; |
132 |
|
|
133 |
|
require Whatpm::H2H; |
134 |
|
$doc = $dom->create_document; |
135 |
|
Whatpm::H2H->parse_string ($s => $doc); |
136 |
|
|
137 |
|
print "#document\n"; |
138 |
|
|
139 |
|
my $out; |
140 |
|
if ($mode[2] eq 'html') { |
141 |
|
$time1 = time; |
142 |
|
$out = \( $doc->inner_html ); |
143 |
|
$time2 = time; |
144 |
|
$time{serialize_xml} = $time2 - $time1; |
145 |
|
} else { # test |
146 |
|
$time1 = time; |
147 |
|
$out = test_serialize ($doc); |
148 |
|
$time2 = time; |
149 |
|
$time{serialize_test} = $time2 - $time1; |
150 |
|
} |
151 |
|
print STDOUT Encode::encode ('utf-8', $$out); |
152 |
|
print STDOUT "\n"; |
153 |
} else { |
} else { |
154 |
print STDOUT "Status: 404 Not Found\nContent-Type: text/plain; charset=us-ascii\n\n404"; |
print STDOUT "Status: 404 Not Found\nContent-Type: text/plain; charset=us-ascii\n\n404"; |
155 |
exit; |
exit; |