Jifty/Plugin/Halo/Mason.pm untested

filter: Statementstmt 0.0% 0 / 38 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 11 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 80 CC 9 SCAR 29.7
CC
9
Cov
0%
start_component_hook
30.0
end_component_hook
30.0
BEGIN
2.0
CRAP 19.5
1 use warnings;
2 use strict;
3 package Jifty::Plugin::Halo::Mason;
4 use base qw/HTML::Mason::Plugin/;
5 use Time::HiRes 'time';
6 use Class::Trigger;
7 use Jifty::Plugin::Halo;
8  
9 =head1 NAME
10  
11 Jifty::View::Mason::Halo - Class for drawing "halos" around page components
12  
13 =head1 DESCRIPTION
14  
15 =head2 start_component_hook CONTEXT_OBJECT
16  
17 Whenever we start to render a component, check to see if we can draw a
18 halo around the component.
19  
20 Either way, record halo metadata.
21  
22 =cut
23  
24 sub start_component_hook {
25 my $self = shift;
26 my $context = shift;
27  
28 return if ($context->comp->path || '') eq "/__jifty/halo";
29 return unless Jifty->handler->stash->{'in_body'};
30 return if $context->comp->is_subcomp;
31  
32 my $frame = Jifty::Plugin::Halo->push_frame(
33 args => [map { eval { defined $_ and fileno( $_ ) } ? "*GLOB*" : $_} @{$context->args}],
34 path => $context->comp->path || '',
35 name => $context->comp->name || '(Unnamed component)',
36 );
37  
38 $context->request->out(Jifty::Plugin::Halo->halo_header($frame));
39 }
40  
41 =head2 end_component_hook CONTEXT_OBJECT
42  
43 When we're done rendering a component, record how long it took
44 and close off the halo C<span> if we have one.
45  
46 =cut
47  
48 sub end_component_hook {
49 my $self = shift;
50 my $context = shift;
51  
52 return if ($context->comp->path || '') eq "/__jifty/halo";
53 return unless Jifty->handler->stash->{'in_body'};
54 return if $context->comp->is_subcomp;
55 return if ${ $context->error };
56  
57 my $frame = Jifty::Plugin::Halo->pop_frame;
58 $context->request->out(Jifty::Plugin::Halo->halo_footer($frame));
59 }
60  
61 1;