← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/bin/epoll_server.pl
  Run on Wed Jan 5 05:34:33 2011
Reported on Wed Jan 5 05:40:24 2011

File /usr/lib/perl5/vendor_perl/5.10.1/Epoll/View/Latex.pm
Statements Executed 19
Statement Execution Time 3.33ms
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111302µs65.8msEpoll::View::Latex::::BEGIN@9 Epoll::View::Latex::BEGIN@9
11187µs353µsEpoll::View::Latex::::BEGIN@4 Epoll::View::Latex::BEGIN@4
11152µs66µsEpoll::View::Latex::::BEGIN@3 Epoll::View::Latex::BEGIN@3
11150µs628µsEpoll::View::Latex::::BEGIN@5 Epoll::View::Latex::BEGIN@5
11140µs309µsLaTeX::Driver::hack::::BEGIN@76LaTeX::Driver::hack::BEGIN@76
0000s0sEpoll::View::Latex::::enabled Epoll::View::Latex::enabled
0000s0sEpoll::View::Latex::::process Epoll::View::Latex::process
0000s0sLaTeX::Driver::hack::::run_commandLaTeX::Driver::hack::run_command
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Epoll::View::Latex;
2
3390µs280µs
# spent 66µs (52+14) within Epoll::View::Latex::BEGIN@3 which was called # once (52µs+14µs) by Catalyst::Utils::ensure_class_loaded at line 3
use strict;
# spent 66µs making 1 call to Epoll::View::Latex::BEGIN@3 # spent 14µs making 1 call to strict::import
4390µs2620µs
# spent 353µs (87+267) within Epoll::View::Latex::BEGIN@4 which was called # once (87µs+267µs) by Catalyst::Utils::ensure_class_loaded at line 4
use base 'Epoll::View::TT';
# spent 353µs making 1 call to Epoll::View::Latex::BEGIN@4 # spent 266µs making 1 call to base::import
53309µs21.21ms
# spent 628µs (50+578) within Epoll::View::Latex::BEGIN@5 which was called # once (50µs+578µs) by Catalyst::Utils::ensure_class_loaded at line 5
use File::Temp;
# spent 628µs making 1 call to Epoll::View::Latex::BEGIN@5 # spent 578µs making 1 call to Exporter::import
6
712µsmy $enable = 0;
8
9
# spent 65.8ms (302µs+65.5) within Epoll::View::Latex::BEGIN@9 which was called # once (302µs+65.5ms) by Catalyst::Utils::ensure_class_loaded at line 14
sub BEGIN {
101826µs265.5ms eval "use LaTeX::Driver";
# spent 65.5ms making 1 call to Epoll::View::Latex::BEGIN@2 # spent 18µs making 1 call to Class::Accessor::import
11116µs if (!$@) {
1213µs $__PACKAGE__::enable = 1;
13 }
141863µs165.8ms}
# spent 65.8ms making 1 call to Epoll::View::Latex::BEGIN@9
15
16155µs27.01ms__PACKAGE__->config(
# spent 5.62ms making 1 call to Catalyst::Component::config # spent 1.39ms making 1 call to Catalyst::path_to
17 TEMPLATE_EXTENSION => '.tt',
18 INCLUDE_PATH => Epoll->path_to( 'root', 'latex' ),
19 PRE_PROCESS => 'includes/header.tt',
20 POST_PROCESS => 'includes/footer.tt',
21 PLUGIN_BASE => 'Epoll::Template::Plugin',
22 POST_CHOMP => 1,
23 PRE_CHOMP => 1,
24);
25
26=head1 NAME
27
28Epoll::View::Latex - Latex View for Epoll
29
30=head1 DESCRIPTION
31
32TT View for Epoll.
33
34=cut
35
36sub enabled {
37 $__PACKAGE__::enable;
38}
39
40sub process {
41 my ($self, $c) = @_;
42
43 $c->stash->{format} ||= 'pdf';
44 my $output = $self->render(
45 $c, $c->stash->{template}
46 );
47
48 if ($c->stash->{format} eq 'tex') {
49 $c->res->body($output);
50 return;
51 }
52
53 my ($fh, $filename) = File::Temp::tempfile(
54 SUFFIX => ('.' . $c->stash->{format}),
55 );
56 close($fh);
57
58 LaTeX::Driver::hack->new(
59 source => \$output,
60 output => $filename,
61 format => $c->stash->{format},
62 )->run;
63 open($fh, '<', $filename);
64 unlink($filename);
65 binmode($fh);
66 $c->res->body(join('', <$fh>));
67 close($fh);
68}
69
70# This is just a hack
71# Don't ask me why, but system() return -1 instead 0
72# under catalyst...
73# This is just an ugly workaround
74
75package LaTeX::Driver::hack;
7631.05ms2579µs
# spent 309µs (40+269) within LaTeX::Driver::hack::BEGIN@76 which was called # once (40µs+269µs) by Catalyst::Utils::ensure_class_loaded at line 76
use base qw(LaTeX::Driver);
# spent 309µs making 1 call to LaTeX::Driver::hack::BEGIN@76 # spent 270µs making 1 call to base::import
77
78sub run_command {
79 my ($self, @args) = @_;
80 for (0 .. 2) {
81 my $res = $self->SUPER::run_command(@args);
82 if ($res > 0) { return $res }
83 }
84 0; # is ok
85}
86
87=head1 SEE ALSO
88
89L<Epoll>
90
91=head1 AUTHOR
92
93Thauvin Olivier
94
95=head1 LICENSE
96
97This library is free software, you can redistribute it and/or modify
98it under the same terms as Perl itself or CeCILL.
99
100=cut
101
102123µs1;