Silki/View/Mason.pm untested

filter: Statementstmt 0.0% 0 / 75 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 20 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 99 CC 1 SCAR 6.9
CC
1
Cov
0%
_nbsp_escape
2.0
has_template_for_path
2.0
BEGIN
2.0
CRAP 2.0
1 package Silki::View::Mason;
2 {
3 $Silki::View::Mason::VERSION = '0.29';
4 }
5  
6 use strict;
7 use warnings;
8  
9 use base 'Catalyst::View::Mason';
10  
11 {
12 package Silki::Mason::Web;
13 {
14 $Silki::Mason::Web::VERSION = '0.29';
15 }
16  
17 use Data::Dumper;
18 use HTML::Entities qw( encode_entities );
19 use Lingua::EN::Inflect qw( A PL_N );
20 use Number::Format qw( format_bytes );
21 use Silki::I18N qw( loc );
22 use Silki::Util qw( string_is_empty english_list );
23 use Silki::URI qw( dynamic_uri static_uri );
24 use URI::Escape qw( uri_escape );
25 }
26  
27 # used in templates
28 use HTML::FillInForm;
29 use Markdent::Simple::Fragment;
30 use Path::Class;
31 use Silki::Config;
32 use Silki::Web::Form;
33 use Silki::Web::FormData;
34 use Silki::Util qw( string_is_empty );
35  
36 {
37 my $config = Silki::Config->instance();
38  
39 my %config = (
40 comp_root => $config->share_dir()->subdir('mason')->stringify(),
41 data_dir =>
42 $config->cache_dir()->subdir( 'mason', 'web' )->stringify(),
43 error_mode => 'fatal',
44 in_package => 'Silki::Mason::Web',
45 use_match => 0,
46 default_escape_flags => 'h',
47 escape_flags => {
48 nbsp => \&_nbsp_escape,
49 },
50 );
51  
52 if ( $config->is_production() ) {
53 $config{static_source} = 1;
54 $config{static_source_touch_file}
55 = $config->etc_dir()->file('mason-touch')->stringify();
56 }
57  
58 __PACKAGE__->config( \%config );
59 }
60  
61 sub _nbsp_escape {
62 ${ $_[0] } =~ s/ / /g;
63  
64 return;
65 }
66  
67 # sub new
68 # {
69 # my $class = shift;
70  
71 # my $self = $class->SUPER::new(@_);
72  
73 # # Silki::Util::chown_files_for_server( $self->template()->files_written() );
74  
75 # return $self;
76 # }
77  
78 sub has_template_for_path {
79 my $self = shift;
80 my $path = shift;
81  
82 return -f file(
83 $self->config()->{comp_root},
84 ( grep { !string_is_empty($_) } split /\//, $path ),
85 );
86 }
87  
88 __PACKAGE__->meta()->make_immutable( inline_constructor => 0 );
89  
90 1;
91  
92 # ABSTRACT: A Mason-based view
93  
94 __END__