Filename | /usr/local/lib/perl5/site_perl/mach/5.24/Razor2/Preproc/deNewline.pm |
Statements | Executed 3 statements in 574µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 628µs | 1.26ms | BEGIN@2 | Razor2::Preproc::deNewline::
0 | 0 | 0 | 0s | 0s | doit | Razor2::Preproc::deNewline::
0 | 0 | 0 | 0s | 0s | isit | Razor2::Preproc::deNewline::
0 | 0 | 0 | 0s | 0s | new | Razor2::Preproc::deNewline::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Razor2::Preproc::deNewline; | ||||
2 | 2 | 568µs | 2 | 1.40ms | # spent 1.26ms (628µs+633µs) within Razor2::Preproc::deNewline::BEGIN@2 which was called:
# once (628µs+633µs) by Razor2::Preproc::Manager::BEGIN@6 at line 2 # spent 1.26ms making 1 call to Razor2::Preproc::deNewline::BEGIN@2
# spent 139µs making 1 call to Exporter::import |
3 | |||||
4 | |||||
5 | sub new { | ||||
6 | return bless {}, shift; | ||||
7 | } | ||||
8 | |||||
9 | |||||
10 | sub isit { | ||||
11 | 1; | ||||
12 | } | ||||
13 | |||||
14 | |||||
15 | sub doit { | ||||
16 | |||||
17 | my ($self, $text) = @_; | ||||
18 | |||||
19 | my ($hdr, $body) = split /\n\r*\n/, $$text, 2; | ||||
20 | |||||
21 | return unless $body; | ||||
22 | |||||
23 | unless ($body =~ s/\n+$//s) { | ||||
24 | return $text; | ||||
25 | } | ||||
26 | |||||
27 | $$text = "$hdr\n\n$body"; | ||||
28 | return $text; | ||||
29 | |||||
30 | } | ||||
31 | |||||
32 | |||||
33 | 1 | 5µs | 1; |