Jifty/View/Mason/Request.pm

filter: Statementstmt 34.0% 17 / 50 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 45.4% 5 / 11 Podpod 100% 6 / 6 totaltotal 31.1% 28 / 90 CC 11 SCAR 34.6
CC
11
Cov
24%
comp
72.0
exec
20.0
auto_send_headers
2.0
CRAP 31.9
« Jifty/Plugin/ActorMetadata/Mixin/Model/ActorMetadata.pm ↑ Summary Jifty/Script/Server.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Jifty::View::Mason::Request;
5 # Subclass for HTML::Mason::Request object $m
6  
7 =head1 NAME
8  
9 Jifty::View::Mason::Request -View mason request
10  
11 =head1 DESCRIPTION
12  
13 Subclass of L<HTML::Mason::Request> which is customised for Jifty's use.
14  
15 =cut
16  
17 1 ▶use HTML::Mason::Exceptions;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use HTML::Mason::Request;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use base qw(HTML::Mason::Request);
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 =head2 auto_send_headers
22  
23 Doesn't send headers if this is a subrequest (according to the current
24 L<Jifty::Request>).
25  
26 =cut
27  
28 0 ▶sub auto_send_headers {
Subroutine auto_send_headers: not called CC=1 SCAR=6.9
Pod documented
29 0 Jifty::View->auto_send_headers;
30 }
31  
32 =head2 exec
33  
34 Actually runs the component; in case no headers have been sent after
35 running the component, and we're supposed to send headers, sends them.
36  
37 =cut
38  
39 sub exec
40 0 ▶{
Subroutine exec: not called CC=4 SCAR=30.0
Pod documented
41 0 my $self = shift;
42 0 my $retval;
43  
44 0 eval { $retval = $self->SUPER::exec(@_) };
45  
46 0 ▶ if (my $err = $@)
Branch: 1 branch
BranchTrueFalseTotal
if (my $err = $@) 0 0 0
47 {
48 0 ▶ $retval = isa_mason_exception($err, 'Abort') ? $err->aborted_value :
Branch: 2 branches
BranchTrueFalseTotal
isa_mason_exception($err, 'Abort') ? : 0 0 0
isa_mason_exception($err, 'Decline') ? : 0 0 0
49 isa_mason_exception($err, 'Decline') ? $err->declined_value :
50 rethrow_exception $err;
51 }
52  
53 0 return $retval;
54 }
55  
56 =head2 print
57  
58 =head2 out
59  
60 Append to the shared L<String::BufferStack> stored in L<Jifty::Handler/buffer>.
61  
62 =cut
63  
64 0 ▶sub print {
Subroutine print: not called CC=1 SCAR=6.9
Pod documented
65 0 shift;
66 0 Jifty->handler->buffer->append(@_);
67 }
68  
69 1 *out = \&print;
70  
71 =head2 comp
72  
73 Jump through hoops necessary to keep L<Jifty::Handler/buffer> lined up
74 with Mason's internal buffer stack.
75  
76 =cut
77  
78 0 ▶sub comp {
Subroutine comp: not called CC=8 SCAR=42.8
Pod documented
79 0 my $self = shift;
80  
81 0 my %mods;
82 0 ▶ %mods = (%{shift()}, %mods) while ref($_[0]) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq "HASH" and do { %mods = (%{shift();}, %mods) } 0 0 0
83 0 my @args;
84 0 ▶ push @args, buffer => delete $mods{store} if $mods{store} and $mods{store} ne \($self->{request_buffer});
Branch: 1 branch
BranchTrueFalseTotal
if $mods{"store"} and $mods{"store"} ne \$self->{"request_buffer"} 0 0 0
Condition0%0/3
$mods{"store"} and $mods{"store"} ne \$self->{"request_buffer"}
!ll&&!rl&&r
000
MC/DC0%0/2
$mods{"store"} and $mods{"store"} ne \$self->{"request_buffer"}
$mods{"store"} $mods{"store"} ne \$self->{"request_buffer"}
Truth table0%0/3
A and B
A= $mods{"store"}B= $mods{"store"} ne \$self->{"request_buffer"}
ABresult
0X0
100
111
85 0 ▶ my $file = (ref $_[0] ? $_[0]{path} : $_[0]);
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
86 0 Jifty->handler->buffer->push(@args, from => "Mason path $file", file => $file);
87  
88 0 my $wantarray = wantarray;
89 0 my @result;
90 0 ▶ if ($wantarray) {
Branch: 2 branches
BranchTrueFalseTotal
if ($wantarray) { } 0 0 0
elsif (defined $wantarray) { } 0 0 0
91 0 @result = $self->SUPER::comp(\%mods, @_);
92 } elsif (defined $wantarray) {
93 0 $result[0] = $self->SUPER::comp(\%mods, @_);
94 } else {
95 0 $self->SUPER::comp(\%mods, @_);
96 }
97 0 Jifty->handler->buffer->pop;
98 0 ▶ return $wantarray ? @result : $result[0];
Branch: 1 branch
BranchTrueFalseTotal
$wantarray ? : 0 0 0
99 }
100  
101 =head2 content
102  
103 Jump through hoops necessary to keep L<Jifty::Handler/buffer> lined up
104 with Mason's internal buffer stack.
105  
106 =cut
107  
108 0 ▶sub content {
Subroutine content: not called CC=1 SCAR=6.9
Pod documented
109 0 my $self = shift;
110  
111 0 Jifty->handler->buffer->push( private => 1, from => "Mason call to content" );
112 0 $self->SUPER::content;
113 0 return Jifty->handler->buffer->pop;
114 }
115  
116 =head2 redirect
117  
118 Calls L<Jifty::Web/redirect>.
119  
120 =cut
121  
122 0 ▶sub redirect {
Subroutine redirect: not called CC=1 SCAR=6.9
Pod documented
123 0 my $self = shift;
124 0 my $url = shift;
125  
126 0 Jifty->web->redirect($url);
127 }
128  
129 1 1;
« Jifty/Plugin/ActorMetadata/Mixin/Model/ActorMetadata.pm ↑ Summary Jifty/Script/Server.pm »