Mojito/Page.pm

filter: Statementstmt 98.4% 63 / 64 Branchbran 50.0% 8 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 95.2% 20 / 21 Podpod 100% 1 / 1 totaltotal 90.2% 92 / 102 CC 9 SCAR 5.1
CC
9
Cov
89%
__ANON__
2.1
__ANON__
2.1
__ANON__
2.1
CRAP 1.7
« Mojito/Page/Parse.pm ↑ Summary Mojito/Auth/Role.pm »
1 3 ▶use strictures 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Mojito::Page;
3 3 $Mojito::Page::VERSION = '0.25';
4 3 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Sub::Quote qw(quote_sub);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 =head1 Name
8  
9 Mojito::Page - the page delegator class
10  
11 =head1 Description
12  
13 An object to delegate to the Page family of objects.
14  
15 =cut
16  
17 =head1 Synopsis
18  
19 use Mojito::Page;
20 my $page_source = $params->{content};
21 my $pager = Mojito::Page->new( page_source => $page_source);
22 my $web_page = $pager->render_page;
23  
24 =cut
25  
26 # delegates
27 3 ▶use Mojito::Page::Parse;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 3 ▶use Mojito::Page::Render;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 3 ▶use Mojito::Page::CRUD;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 3 ▶use Mojito::Page::Git;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 3 ▶use Mojito::Page::Publish;
Subroutine BEGIN: called CC=1 SCAR=0.0
32 3 ▶use Mojito::Template;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 3 ▶use Mojito::Model::Link;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 3 ▶use Mojito::Collection::CRUD;
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 3 with 'Mojito::Role::Config';
37  
38 # roles
39  
40 has parser => (
41 is => 'ro',
42 1 ▶ isa => sub { die "Need a PageParse object. Have ref($_[0]) instead." unless $_[0]->isa('Mojito::Page::Parse') },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0]->isa("Mojito::Page::Parse") 0 1 1
43 lazy => 1,
44 handles => [
45 qw(
46 page_structure
47 )
48 ],
49 writer => '_build_parse',
50 0 ▶ default => sub { Mojito::Page::Parse->new }
Subroutine __ANON__: not called CC=1 SCAR=6.9
51 3 );
52  
53 has render => (
54 is => 'ro',
55 1 ▶ isa => sub { die "Need a PageRender object" unless $_[0]->isa('Mojito::Page::Render') },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0]->isa("Mojito::Page::Render") 0 1 1
56 3 handles => [
57 qw(
58 render_page
59 render_body
60 intro_text
61 )
62 ],
63 writer => '_build_render',
64 );
65  
66 has editer => (
67 is => 'ro',
68 1 ▶ isa => sub { die "Need a PageEdit object" unless $_[0]->isa('Mojito::Page::CRUD') },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0]->isa("Mojito::Page::CRUD") 0 1 1
69 3 handles => [
70 qw(
71 create
72 read
73 update
74 delete
75 db
76 collection
77 )
78 ],
79 writer => '_build_edit',
80 );
81  
82 has collector => (
83 is => 'ro',
84 1 ▶ isa => sub { die "Need a Collection::CRUD object" unless $_[0]->isa('Mojito::Collection::CRUD') },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0]->isa("Mojito::Collection::CRUD") 0 1 1
85 3 handles => [ qw( ) ],
86 writer => '_build_collect',
87 );
88  
89 has tmpl => (
90 is => 'ro',
91 1 ▶ isa => sub { die "Need a Template object" unless $_[0]->isa('Mojito::Template') },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0]->isa("Mojito::Template") 0 1 1
92 3 handles => [
93 qw(
94 template
95 home_page
96 recent_links
97 collect_page_form
98 collections_index
99 collection_page
100 sort_collection_form
101 fillin_create_page
102 fillin_edit_page
103 calendar_month_page
104 wrap_page
105 )
106 ],
107 writer => '_build_template',
108 );
109  
110 has linker => (
111 is => 'ro',
112 1 ▶ isa => sub { die "Need a Link Model object" unless $_[0]->isa('Mojito::Model::Link') },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0]->isa("Mojito::Model::Link") 0 1 1
113 3 handles => [
114 qw(
115 get_recent_links
116 get_feed_links
117 view_collections_index
118 view_collection_nav
119 get_atom_feed
120 )
121 ],
122 writer => '_build_link',
123 );
124  
125 has gitter => (
126 is => 'ro',
127 1 ▶ isa => sub { die "Need a PageGit object" unless $_[0]->isa('Mojito::Page::Git') },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0]->isa("Mojito::Page::Git") 0 1 1
128 3 handles => [
129 qw(
130 commit_page
131 rm_page
132 diff_page
133 search_word
134 get_author_for
135 )
136 ],
137 writer => '_build_git',
138 );
139  
140 has publisher => (
141 is => 'ro',
142 1 ▶ isa => sub { die "Need a PagePublish object" unless $_[0]->isa('Mojito::Page::Publish') },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0]->isa("Mojito::Page::Publish") 0 1 1
143 3 handles => [ qw( ) ],
144 writer => '_build_publish',
145 );
146  
147 =head1 Methods
148  
149 =head2 BUILD
150  
151 Create the handler objects
152  
153 =cut
154  
155 1 ▶sub BUILD {
Subroutine BUILD: called CC=1 SCAR=0.0
Pod documented
156 1 my $self = shift;
157 1 my $constructor_args_href = shift;
158
159 # Pass the config to the delegatees so they don't have to build it.
160 1 $constructor_args_href->{config} = $self->config;
161  
162 # pass the options into the subclasses
163 1 $self->_build_parse(Mojito::Page::Parse->new($constructor_args_href));
164 1 $self->_build_render(Mojito::Page::Render->new($constructor_args_href));
165 1 $self->_build_edit(Mojito::Page::CRUD->new($constructor_args_href));
166 1 $self->_build_collect(Mojito::Collection::CRUD->new($constructor_args_href));
167 1 $self->_build_git(Mojito::Page::Git->new($constructor_args_href));
168 1 $self->_build_template(Mojito::Template->new($constructor_args_href));
169 1 $self->_build_link(Mojito::Model::Link->new($constructor_args_href));
170 1 $self->_build_publish(Mojito::Page::Publish->new($constructor_args_href));
171 }
172  
173 3 1
« Mojito/Page/Parse.pm ↑ Summary Mojito/Auth/Role.pm »