← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:45:08 2010
Reported on Wed Nov 17 22:14:11 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/Markdent/Role/HTMLStream.pm
StatementsExecuted 27 statements in 9.13ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1119.49ms18.8msMarkdent::Role::HTMLStream::::BEGIN@9Markdent::Role::HTMLStream::BEGIN@9
1115.31ms39.3msMarkdent::Role::HTMLStream::::BEGIN@15Markdent::Role::HTMLStream::BEGIN@15
11156µs27.9msMarkdent::Role::HTMLStream::::BEGIN@10Markdent::Role::HTMLStream::BEGIN@10
11152µs52µsMarkdent::Role::HTMLStream::::BEGIN@2Markdent::Role::HTMLStream::BEGIN@2
11142µs14.6msMarkdent::Role::HTMLStream::::BEGIN@18Markdent::Role::HTMLStream::BEGIN@18
11142µs217µsMarkdent::Role::HTMLStream::::BEGIN@17Markdent::Role::HTMLStream::BEGIN@17
11138µs56µsMarkdent::Role::HTMLStream::::BEGIN@6Markdent::Role::HTMLStream::BEGIN@6
11136µs106µsMarkdent::Role::HTMLStream::::BEGIN@7Markdent::Role::HTMLStream::BEGIN@7
0000s0sMarkdent::Role::HTMLStream::::__ANON__[:36]Markdent::Role::HTMLStream::__ANON__[:36]
0000s0sMarkdent::Role::HTMLStream::::auto_linkMarkdent::Role::HTMLStream::auto_link
0000s0sMarkdent::Role::HTMLStream::::end_blockquoteMarkdent::Role::HTMLStream::end_blockquote
0000s0sMarkdent::Role::HTMLStream::::end_codeMarkdent::Role::HTMLStream::end_code
0000s0sMarkdent::Role::HTMLStream::::end_emphasisMarkdent::Role::HTMLStream::end_emphasis
0000s0sMarkdent::Role::HTMLStream::::end_headerMarkdent::Role::HTMLStream::end_header
0000s0sMarkdent::Role::HTMLStream::::end_html_tagMarkdent::Role::HTMLStream::end_html_tag
0000s0sMarkdent::Role::HTMLStream::::end_linkMarkdent::Role::HTMLStream::end_link
0000s0sMarkdent::Role::HTMLStream::::end_list_itemMarkdent::Role::HTMLStream::end_list_item
0000s0sMarkdent::Role::HTMLStream::::end_ordered_listMarkdent::Role::HTMLStream::end_ordered_list
0000s0sMarkdent::Role::HTMLStream::::end_paragraphMarkdent::Role::HTMLStream::end_paragraph
0000s0sMarkdent::Role::HTMLStream::::end_strongMarkdent::Role::HTMLStream::end_strong
0000s0sMarkdent::Role::HTMLStream::::end_tableMarkdent::Role::HTMLStream::end_table
0000s0sMarkdent::Role::HTMLStream::::end_table_bodyMarkdent::Role::HTMLStream::end_table_body
0000s0sMarkdent::Role::HTMLStream::::end_table_cellMarkdent::Role::HTMLStream::end_table_cell
0000s0sMarkdent::Role::HTMLStream::::end_table_headerMarkdent::Role::HTMLStream::end_table_header
0000s0sMarkdent::Role::HTMLStream::::end_table_rowMarkdent::Role::HTMLStream::end_table_row
0000s0sMarkdent::Role::HTMLStream::::end_unordered_listMarkdent::Role::HTMLStream::end_unordered_list
0000s0sMarkdent::Role::HTMLStream::::horizontal_ruleMarkdent::Role::HTMLStream::horizontal_rule
0000s0sMarkdent::Role::HTMLStream::::html_blockMarkdent::Role::HTMLStream::html_block
0000s0sMarkdent::Role::HTMLStream::::html_commentMarkdent::Role::HTMLStream::html_comment
0000s0sMarkdent::Role::HTMLStream::::html_comment_blockMarkdent::Role::HTMLStream::html_comment_block
0000s0sMarkdent::Role::HTMLStream::::html_entityMarkdent::Role::HTMLStream::html_entity
0000s0sMarkdent::Role::HTMLStream::::html_tagMarkdent::Role::HTMLStream::html_tag
0000s0sMarkdent::Role::HTMLStream::::imageMarkdent::Role::HTMLStream::image
0000s0sMarkdent::Role::HTMLStream::::preformattedMarkdent::Role::HTMLStream::preformatted
0000s0sMarkdent::Role::HTMLStream::::start_blockquoteMarkdent::Role::HTMLStream::start_blockquote
0000s0sMarkdent::Role::HTMLStream::::start_codeMarkdent::Role::HTMLStream::start_code
0000s0sMarkdent::Role::HTMLStream::::start_emphasisMarkdent::Role::HTMLStream::start_emphasis
0000s0sMarkdent::Role::HTMLStream::::start_headerMarkdent::Role::HTMLStream::start_header
0000s0sMarkdent::Role::HTMLStream::::start_html_tagMarkdent::Role::HTMLStream::start_html_tag
0000s0sMarkdent::Role::HTMLStream::::start_linkMarkdent::Role::HTMLStream::start_link
0000s0sMarkdent::Role::HTMLStream::::start_list_itemMarkdent::Role::HTMLStream::start_list_item
0000s0sMarkdent::Role::HTMLStream::::start_ordered_listMarkdent::Role::HTMLStream::start_ordered_list
0000s0sMarkdent::Role::HTMLStream::::start_paragraphMarkdent::Role::HTMLStream::start_paragraph
0000s0sMarkdent::Role::HTMLStream::::start_strongMarkdent::Role::HTMLStream::start_strong
0000s0sMarkdent::Role::HTMLStream::::start_tableMarkdent::Role::HTMLStream::start_table
0000s0sMarkdent::Role::HTMLStream::::start_table_bodyMarkdent::Role::HTMLStream::start_table_body
0000s0sMarkdent::Role::HTMLStream::::start_table_cellMarkdent::Role::HTMLStream::start_table_cell
0000s0sMarkdent::Role::HTMLStream::::start_table_headerMarkdent::Role::HTMLStream::start_table_header
0000s0sMarkdent::Role::HTMLStream::::start_table_rowMarkdent::Role::HTMLStream::start_table_row
0000s0sMarkdent::Role::HTMLStream::::start_unordered_listMarkdent::Role::HTMLStream::start_unordered_list
0000s0sMarkdent::Role::HTMLStream::::textMarkdent::Role::HTMLStream::text
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Markdent::Role::HTMLStream;
2
# spent 52µs within Markdent::Role::HTMLStream::BEGIN@2 which was called: # once (52µs+0s) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 4
BEGIN {
3130µs $Markdent::Role::HTMLStream::VERSION = '0.17';
4176µs152µs}
# spent 52µs making 1 call to Markdent::Role::HTMLStream::BEGIN@2
5
6393µs274µs
# spent 56µs (38+18) within Markdent::Role::HTMLStream::BEGIN@6 which was called: # once (38µs+18µs) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 6
use strict;
# spent 56µs making 1 call to Markdent::Role::HTMLStream::BEGIN@6 # spent 18µs making 1 call to strict::import
7396µs2176µs
# spent 106µs (36+70) within Markdent::Role::HTMLStream::BEGIN@7 which was called: # once (36µs+70µs) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 7
use warnings;
# spent 106µs making 1 call to Markdent::Role::HTMLStream::BEGIN@7 # spent 70µs making 1 call to warnings::import
8
93716µs218.9ms
# spent 18.8ms (9.49+9.27) within Markdent::Role::HTMLStream::BEGIN@9 which was called: # once (9.49ms+9.27ms) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 9
use HTML::Stream;
# spent 18.8ms making 1 call to Markdent::Role::HTMLStream::BEGIN@9 # spent 158µs making 1 call to Exporter::import
10141µs127.8ms
# spent 27.9ms (56µs+27.8) within Markdent::Role::HTMLStream::BEGIN@10 which was called: # once (56µs+27.8ms) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 14
use Markdent::Types qw(
# spent 27.8ms making 1 call to MooseX::Types::Combine::import
11 HeaderLevel Str Bool HashRef
12 TableCellAlignment PosInt
13 OutputStream
142187µs127.9ms);
# spent 27.9ms making 1 call to Markdent::Role::HTMLStream::BEGIN@10
153798µs240.5ms
# spent 39.3ms (5.31+33.9) within Markdent::Role::HTMLStream::BEGIN@15 which was called: # once (5.31ms+33.9ms) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 15
use MooseX::Params::Validate qw( validated_list validated_hash );
# spent 39.3ms making 1 call to Markdent::Role::HTMLStream::BEGIN@15 # spent 1.29ms making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:756]
16
173105µs2392µs
# spent 217µs (42+175) within Markdent::Role::HTMLStream::BEGIN@17 which was called: # once (42µs+175µs) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 17
use namespace::autoclean;
# spent 217µs making 1 call to Markdent::Role::HTMLStream::BEGIN@17 # spent 175µs making 1 call to namespace::autoclean::import
1836.69ms229.2ms
# spent 14.6ms (42µs+14.6) within Markdent::Role::HTMLStream::BEGIN@18 which was called: # once (42µs+14.6ms) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 18
use Moose::Role;
# spent 14.6ms making 1 call to Markdent::Role::HTMLStream::BEGIN@18 # spent 14.6ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456]
19
20119µs175.5mswith 'Markdent::Role::EventsAsMethods';
# spent 75.5ms making 1 call to Moose::Role::with
21
22113µs1479µsrequires qw( start_document end_document );
# spent 479µs making 1 call to Moose::Role::requires
23
24125µs21.28mshas _output => (
# spent 962µs making 1 call to Moose::Role::has # spent 323µs making 1 call to __TYPE__::Markdent::Types::Internal::OutputStream
25 is => 'ro',
26 isa => OutputStream,
27 required => 1,
28 init_arg => 'output',
29);
30
31has _stream => (
32 is => 'ro',
33 isa => 'HTML::Stream',
34 init_arg => undef,
35 lazy => 1,
36 default => sub { HTML::Stream->new( $_[0]->_output() ) },
37124µs1670µs);
# spent 670µs making 1 call to Moose::Role::has
38
39sub start_header {
40 my $self = shift;
41 my ($level) = validated_list( \@_,
42 level => { isa => HeaderLevel },
43 );
44
45 my $tag = 'h' . $level;
46
47 $self->_stream()->tag($tag);
48}
49
50sub end_header {
51 my $self = shift;
52 my ($level) = validated_list( \@_,
53 level => { isa => HeaderLevel },
54 );
55
56 my $tag = '_h' . $level;
57
58 $self->_stream()->tag($tag);
59}
60
61sub start_blockquote {
62 my $self = shift;
63
64 $self->_stream()->tag('blockquote');
65}
66
67sub end_blockquote {
68 my $self = shift;
69
70 $self->_stream()->tag('_blockquote');
71}
72
73sub start_unordered_list {
74 my $self = shift;
75
76 $self->_stream()->tag('ul');
77}
78
79sub end_unordered_list {
80 my $self = shift;
81
82 $self->_stream()->tag('_ul');
83}
84
85sub start_ordered_list {
86 my $self = shift;
87
88 $self->_stream()->tag('ol');
89}
90
91sub end_ordered_list {
92 my $self = shift;
93
94 $self->_stream()->tag('_ol');
95}
96
97sub start_list_item {
98 my $self = shift;
99
100 $self->_stream()->tag('li');
101}
102
103sub end_list_item {
104 my $self = shift;
105
106 $self->_stream()->tag('_li');
107}
108
109sub preformatted {
110 my $self = shift;
111 my ($text) = validated_list( \@_, text => { isa => Str }, );
112
113 $self->_stream()->tag('pre');
114 $self->_stream()->tag('code');
115 $self->_stream()->text($text);
116 $self->_stream()->tag('_code');
117 $self->_stream()->tag('_pre');
118}
119
120sub start_paragraph {
121 my $self = shift;
122
123 $self->_stream()->tag('p');
124}
125
126sub end_paragraph {
127 my $self = shift;
128
129 $self->_stream()->tag('_p');
130}
131
132sub start_table {
133 my $self = shift;
134 my ($caption) = validated_list(
135 \@_,
136 caption => { isa => Str, optional => 1 },
137 );
138
139 $self->_stream()->tag('table');
140
141 if ( defined $caption && length $caption ) {
142 $self->_stream()->tag('caption');
143 $self->_stream()->text($caption);
144 $self->_stream()->tag('_caption');
145 }
146}
147
148sub end_table {
149 my $self = shift;
150
151 $self->_stream()->tag('_table');
152}
153
154sub start_table_header {
155 my $self = shift;
156
157 $self->_stream()->tag('thead');
158}
159
160sub end_table_header {
161 my $self = shift;
162
163 $self->_stream()->tag('_thead');
164}
165
166sub start_table_body {
167 my $self = shift;
168
169 $self->_stream()->tag('tbody');
170}
171
172sub end_table_body {
173 my $self = shift;
174
175 $self->_stream()->tag('_tbody');
176}
177
178sub start_table_row {
179 my $self = shift;
180
181 $self->_stream()->tag('tr');
182}
183
184sub end_table_row {
185 my $self = shift;
186
187 $self->_stream()->tag('_tr');
188}
189
190sub start_table_cell {
191 my $self = shift;
192 my ( $alignment, $colspan, $is_header ) = validated_list(
193 \@_,
194 alignment => { isa => TableCellAlignment, optional => 1 },
195 colspan => { isa => PosInt },
196 is_header_cell => { isa => Bool },
197 );
198
199 my $tag = $is_header ? 'th' : 'td';
200
201 my %attr = ( align => $alignment );
202 $attr{colspan} = $colspan
203 if $colspan != 1;
204
205 $self->_stream()->tag( $tag, %attr );
206}
207
208sub end_table_cell {
209 my $self = shift;
210 my ($is_header) = validated_hash(
211 \@_,
212 is_header_cell => { isa => Bool },
213 );
214
215 $self->_stream()->tag( $is_header ? '_th' : '_td' );
216}
217
218sub start_emphasis {
219 my $self = shift;
220
221 $self->_stream()->tag('em');
222}
223
224sub end_emphasis {
225 my $self = shift;
226
227 $self->_stream()->tag('_em');
228}
229
230sub start_strong {
231 my $self = shift;
232
233 $self->_stream()->tag('strong');
234}
235
236sub end_strong {
237 my $self = shift;
238
239 $self->_stream()->tag('_strong');
240}
241
242sub start_code {
243 my $self = shift;
244
245 $self->_stream()->tag('code');
246}
247
248sub end_code {
249 my $self = shift;
250
251 $self->_stream()->tag('_code');
252}
253
254sub auto_link {
255 my $self = shift;
256 my ($uri) = validated_list(
257 \@_,
258 uri => { isa => Str, optional => 1 },
259 );
260
261 $self->_stream()->tag( 'a', href => $uri );
262 $self->_stream()->text($uri);
263 $self->_stream()->tag('_a');
264}
265
266sub start_link {
267 my $self = shift;
268 my %p = validated_hash(
269 \@_,
270 uri => { isa => Str },
271 title => { isa => Str, optional => 1 },
272 id => { isa => Str, optional => 1 },
273 is_implicit_id => { isa => Bool, optional => 1 },
274 );
275
276 delete @p{ grep { ! defined $p{$_} } keys %p };
277
278 $self->_stream()->tag(
279 'a', href => $p{uri},
280 exists $p{title} ? ( title => $p{title} ) : (),
281 );
282}
283
284sub end_link {
285 my $self = shift;
286
287 $self->_stream()->tag('_a');
288}
289
290sub text {
291 my $self = shift;
292 my ($text) = validated_list( \@_, text => { isa => Str }, );
293
294 $self->_stream()->text($text);
295}
296
297sub start_html_tag {
298 my $self = shift;
299 my ( $tag, $attributes ) = validated_list(
300 \@_,
301 tag => { isa => Str },
302 attributes => { isa => HashRef },
303 );
304
305 $self->_stream()->tag( $tag, %{$attributes} );
306}
307
308sub html_comment_block {
309 my $self = shift;
310 my ($text) = validated_list(
311 \@_,
312 text => { isa => Str },
313 );
314
315 # HTML::Stream->comment() adds extra whitespace for no good reason.
316 $self->_output()->print( '<!--' . $text . '-->' . "\n" );
317}
318
319sub html_comment {
320 my $self = shift;
321 my ($text) = validated_list(
322 \@_,
323 text => { isa => Str },
324 );
325
326 # HTML::Stream->comment() adds extra whitespace for no good reason.
327 $self->_output()->print( '<!--' . $text . '-->' );
328}
329
330sub html_tag {
331 my $self = shift;
332 my ( $tag, $attributes ) = validated_list(
333 \@_,
334 tag => { isa => Str },
335 attributes => { isa => HashRef },
336 );
337
338 $self->_stream()->tag( $tag, %{$attributes} );
339}
340
341sub end_html_tag {
342 my $self = shift;
343 my ($tag) = validated_list(
344 \@_,
345 tag => { isa => Str },
346 );
347
348 $self->_stream()->tag( q{_} . $tag );
349}
350
351sub html_entity {
352 my $self = shift;
353 my ($entity) = validated_list( \@_, entity => { isa => Str }, );
354
355 $self->_stream()->ent($entity);
356}
357
358sub html_block {
359 my $self = shift;
360 my ($html) = validated_list( \@_, html => { isa => Str }, );
361
362 $self->_output()->print($html);
363}
364
365sub image {
366 my $self = shift;
367 my %p = validated_hash(
368 \@_,
369 alt_text => { isa => Str },
370 uri => { isa => Str, optional => 1 },
371 title => { isa => Str, optional => 1 },
372 id => { isa => Str, optional => 1 },
373 is_implicit_id => { isa => Bool, optional => 1 },
374 );
375
376 delete @p{ grep { ! defined $p{$_} } keys %p };
377
378 $self->_stream()->tag(
379 'img', src => $p{uri},
380 ( exists $p{alt_text} ? ( alt => $p{alt_text} ) : () ),
381 ( exists $p{title} ? ( title => $p{title} ) : () ),
382 );
383}
384
385sub horizontal_rule {
386 my $self = shift;
387
388 $self->_stream()->tag('hr');
389}
390
3911132µs1;
392
393# ABSTRACT: A role for handlers which generate HTML
394
- -
397=pod
398
- -
440186µs148.1ms__END__