line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pinwheel::Helpers::Core; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
86870
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
179
|
|
4
|
5
|
|
|
5
|
|
25
|
use warnings; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
132
|
|
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
26
|
use Exporter; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
791
|
|
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
636
|
use Pinwheel::Context; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
134
|
|
9
|
5
|
|
|
5
|
|
2357
|
use Pinwheel::View::String; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
3043
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
12
|
|
|
|
|
|
|
our @EXPORT_OK = qw(content_for yield urlencode urldecode); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub content_for |
16
|
|
|
|
|
|
|
{ |
17
|
4
|
|
|
4
|
0
|
42
|
my ($name, $fn) = @_; |
18
|
4
|
|
|
|
|
5
|
my ($ctx, $s); |
19
|
|
|
|
|
|
|
|
20
|
4
|
|
|
|
|
14
|
$ctx = Pinwheel::Context::get('render'); |
21
|
4
|
|
|
|
|
12
|
$s = &$fn; |
22
|
4
|
100
|
|
|
|
34
|
$s = Pinwheel::View::String->new($s) unless ref($s); |
23
|
|
|
|
|
|
|
|
24
|
4
|
|
100
|
|
|
71
|
$ctx->{content}{$name} = ($ctx->{content}{$name} || '') . $s; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub yield |
28
|
|
|
|
|
|
|
{ |
29
|
4
|
|
100
|
4
|
0
|
17
|
return Pinwheel::Context::get('render')->{content}{shift() || 'layout'}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub urlencode |
33
|
|
|
|
|
|
|
{ |
34
|
3
|
|
|
3
|
0
|
3103
|
my $str = shift; |
35
|
3
|
|
|
|
|
25
|
$str =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; |
|
7
|
|
|
|
|
43
|
|
36
|
3
|
|
|
|
|
22
|
return $str; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub urldecode |
40
|
|
|
|
|
|
|
{ |
41
|
3
|
|
|
3
|
0
|
8
|
my $str = shift; |
42
|
3
|
|
|
|
|
20
|
$str =~ s/%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg; |
|
7
|
|
|
|
|
37
|
|
43
|
3
|
|
|
|
|
15
|
return $str; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |