31 |
my $doc; |
my $doc; |
32 |
my $el; |
my $el; |
33 |
|
|
34 |
|
|
35 |
if (@mode == 3 and $mode[0] eq 'html' and |
if (@mode == 3 and $mode[0] eq 'html' and |
36 |
($mode[2] eq 'html' or $mode[2] eq 'test')) { |
($mode[2] eq 'html' or $mode[2] eq 'test' or $mode[2] eq 'xml')) { |
37 |
print STDOUT "Content-Type: text/plain; charset=utf-8\n\n"; |
print STDOUT "Content-Type: text/plain; charset=utf-8\n\n"; |
38 |
|
|
39 |
require Encode; |
require Encode; |
49 |
|
|
50 |
my $onerror = sub { |
my $onerror = sub { |
51 |
my (%opt) = @_; |
my (%opt) = @_; |
52 |
print STDOUT "$opt{line},$opt{column},$opt{type}\n"; |
print STDOUT "$opt{line},$opt{column},$opt{type};$opt{level};$opt{value}\n"; |
53 |
}; |
}; |
54 |
|
|
55 |
$doc = $dom->create_document; |
$doc = $dom->create_document; |
73 |
$out = \( ($el or $doc)->inner_html ); |
$out = \( ($el or $doc)->inner_html ); |
74 |
$time2 = time; |
$time2 = time; |
75 |
$time{serialize_html} = $time2 - $time1; |
$time{serialize_html} = $time2 - $time1; |
76 |
|
} elsif ($mode[2] eq 'xml') { |
77 |
|
$doc->manakai_is_html (0); |
78 |
|
$time1 = time; |
79 |
|
$out = \( ($el or $doc)->inner_html ); |
80 |
|
$time2 = time; |
81 |
|
$time{serialize_xml} = $time2 - $time1; |
82 |
|
$doc->manakai_is_html (1); |
83 |
} else { # test |
} else { # test |
84 |
$time1 = time; |
$time1 = time; |
85 |
$out = test_serialize ($el || $doc); |
$out = test_serialize ($el || $doc); |
89 |
print STDOUT Encode::encode ('utf-8', $$out); |
print STDOUT Encode::encode ('utf-8', $$out); |
90 |
print STDOUT "\n"; |
print STDOUT "\n"; |
91 |
} elsif (@mode == 3 and $mode[0] eq 'xhtml' and |
} elsif (@mode == 3 and $mode[0] eq 'xhtml' and |
92 |
($mode[2] eq 'html' or $mode[2] eq 'test')) { |
($mode[2] eq 'html' or $mode[2] eq 'test' or $mode[2] eq 'xml')) { |
93 |
print STDOUT "Content-Type: text/plain; charset=utf-8\n\n"; |
print STDOUT "Content-Type: text/plain; charset=utf-8\n\n"; |
94 |
|
|
95 |
require Message::DOM::XMLParserTemp; |
require Message::DOM::XMLParserTemp; |
114 |
|
|
115 |
my $out; |
my $out; |
116 |
if ($mode[2] eq 'html') { |
if ($mode[2] eq 'html') { |
117 |
|
$doc->manakai_is_html (0); |
118 |
|
$time1 = time; |
119 |
|
$out = \( $doc->inner_html ); ## TODO: $el case |
120 |
|
$time2 = time; |
121 |
|
$time{serialize_html} = $time2 - $time1; |
122 |
|
$doc->manakai_is_html (1); |
123 |
|
} elsif ($mode[2] eq 'xml') { |
124 |
$time1 = time; |
$time1 = time; |
125 |
$out = \( $doc->inner_html ); ## TODO: $el case |
$out = \( $doc->inner_html ); ## TODO: $el case |
126 |
$time2 = time; |
$time2 = time; |
134 |
print STDOUT Encode::encode ('utf-8', $$out); |
print STDOUT Encode::encode ('utf-8', $$out); |
135 |
print STDOUT "\n"; |
print STDOUT "\n"; |
136 |
} elsif (@mode == 3 and $mode[0] eq 'h2h' and $mode[1] eq '' and |
} elsif (@mode == 3 and $mode[0] eq 'h2h' and $mode[1] eq '' and |
137 |
($mode[2] eq 'html' or $mode[2] eq 'test')) { |
($mode[2] eq 'html' or $mode[2] eq 'test' or $mode[2] eq 'xml')) { |
138 |
print STDOUT "Content-Type: text/plain; charset=utf-8\n\n"; |
print STDOUT "Content-Type: text/plain; charset=utf-8\n\n"; |
139 |
|
|
140 |
require Encode; |
require Encode; |
151 |
|
|
152 |
my $out; |
my $out; |
153 |
if ($mode[2] eq 'html') { |
if ($mode[2] eq 'html') { |
154 |
|
$doc->manakai_is_html (0); |
155 |
|
$time1 = time; |
156 |
|
$out = \( $doc->inner_html ); |
157 |
|
$time2 = time; |
158 |
|
$time{serialize_html} = $time2 - $time1; |
159 |
|
$doc->manakai_is_html (1); |
160 |
|
} elsif ($mode[2] eq 'xml') { |
161 |
$time1 = time; |
$time1 = time; |
162 |
$out = \( $doc->inner_html ); |
$out = \( $doc->inner_html ); |
163 |
$time2 = time; |
$time2 = time; |