Model/Text/MicroTemplate/ViewData.pm

filter: Statementstmt 100% 14 / 14 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 95.0% 19 / 20 CC 2 SCAR 3.4
CC
2
Cov
94%
AUTOLOAD
2.0
BEGIN
1.0
build_per_context_instance
1.0
CRAP 1.4
« View/Text/MicroTemplate/_PerRequest.pm ↑ Summary View/Text/MicroTemplate/PerRequest.pm »
1 package Catalyst::Model::Text::MicroTemplate::ViewData;
2  
3 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4
5 1 extends 'Catalyst::Model';
6 1 with 'Catalyst::Component::InstancePerContext';
7 1 with 'Data::Perl::Role::Collection::Hash';
8
9 5 ▶sub build_per_context_instance {
Subroutine build_per_context_instance: called CC=1 SCAR=0.0
10 5 my ($self, $c, %args) = @_;
11 5 return $self->new(%args);
12 }
13  
14 5 ▶sub TO_HASH { return shift->elements }
Subroutine TO_HASH: called CC=1 SCAR=0.0
15  
16 10 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=2 SCAR=7.0
17 10 my ($self, @args) = @_;
18 10 my $key = our $AUTOLOAD;
19 10 $key =~ s/.*:://;
20 10 ▶ return scalar(@args) ?
Branch: 1 branch
BranchTrueFalseTotal
scalar @args ? : 10 0 10
21 $self->set($key, @args)
22 : $self->get($key);
23 }
24
25 1 1;
26  
27 =head1 NAME
28  
29 Catalyst::Model::Text::MicroTemplate::ViewData - Default model for Catalyst::View::Text::MicroTemplate::PerRequest
30  
31 =head1 SYNOPSIS
32  
33 sub root :Chained(/) CaptureArgs(0) {
34 my ($self, $c) = @_;
35 $c->view->data->set(z=>1);
36 }
37  
38 =head1 DESCRIPTION
39  
40 This is the default model used by L<Catalyst::View::Text::MicroTemplate::PerRequest> to
41 collect information that will be presented as data to the client.
42  
43 Generally you will access this via '$c->view->data'. However it is setup as a
44 per request model in Catalyst so you can access it via '$c->model("Text::MicroTemplate::ViewData")'.
45 which might have some use if you are populating values in other dependent models.
46  
47 =head1 METHODS
48  
49 This model consumes the role L<Data::Perl::Role::Collection::Hash> and gets
50 all its method from it.
51  
52 =head1 SEE ALSO
53  
54 L<Catalyst::View::Text::MicroTemplate::PerRequest>, L<Catalyst>, L<Data::Perl>, L<Moo>.
55  
56 =head1 AUTHOR
57
58 John Napiorkowski L<email:jjnapiork@cpan.org>
59
60 =head1 COPYRIGHT & LICENSE
61
62 Copyright 2015, John Napiorkowski L<email:jjnapiork@cpan.org>
63
64 This library is free software; you can redistribute it and/or modify it under
65 the same terms as Perl itself.
66  
67 =cut
« View/Text/MicroTemplate/_PerRequest.pm ↑ Summary View/Text/MicroTemplate/PerRequest.pm »