File Coverage

lib/Egg/Manager/View.pm
Criterion Covered Total %
statement 9 34 26.4
branch 0 4 0.0
condition 0 2 0.0
subroutine 3 12 25.0
pod n/a
total 12 52 23.0


line stmt bran cond sub pod time code
1             package Egg::Manager::View;
2             #
3             # Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
4             #
5             # $Id: View.pm 337 2008-05-14 12:30:09Z lushe $
6             #
7 1     1   432 use strict;
  1         2  
  1         38  
8 1     1   6 use warnings;
  1         1  
  1         465  
9              
10             our $VERSION= '3.00';
11              
12             my $handler= 'Egg::Manager::View::handler';
13              
14             sub init_view {
15 0     0     my($class)= @_;
16 0           $handler->initialize('view');
17 0 0         $class->mk_classdata('view_manager') unless $class->can('view_manager');
18 0           $class;
19             }
20             sub setup_view {
21 0     0     my($e)= @_;
22 0           $e->view_manager($handler->new($e))->setup_manager;
23             }
24             sub view {
25 0     0     shift->view_manager->context(@_);
26             }
27             sub is_view {
28 0     0     my $e= shift;
29 0   0       my $label= shift || return 0;
30 0 0         $e->view_manager->regists->{lc($label)} ? 1: 0;
31             }
32             sub _prepare {
33 0     0     my($e)= @_;
34 0           $e->view_manager->_prepare($e);
35 0           $e->next::method;
36             }
37             sub _finalize {
38 0     0     my($e)= @_;
39 0           $e->view_manager->_finalize($e);
40 0           $e->next::method;
41             }
42             sub _finalize_error {
43 0     0     my($e)= @_;
44 0           $e->view_manager->_finalize_error($e);
45 0           $e->next::method;
46             }
47             sub _output {
48 0     0     my($e)= @_;
49 0           $e->view_manager->_output($e);
50 0           $e->next::method;
51             }
52             sub _finish {
53 0     0     my($e)= @_;
54 0           $e->view_manager->_finish($e);
55 0           $e->next::method;
56             }
57              
58             package Egg::Manager::View::handler;
59 1     1   7 use base qw/ Egg::Manager /;
  1         2  
  1         139  
60              
61             1;
62              
63             __END__
64              
65             =head1 NAME
66              
67             Egg::Manager::View - View manager for Egg.
68              
69             =head1 DESCRIPTION
70              
71             It is a module to offer Egg the view function.
72              
73             When the view_manager method of Egg is called, the handler class for the view
74             is returned.
75              
76             =head1 CONFIGURATION
77              
78             The configuration of the model is done to 'VIEW' by the ARRAY form.
79              
80             VIEW => [
81             [ Mason => {
82             ...........
83             ....
84             } ],
85             [ HT => {
86             ...........
87             ....
88             } ],
89             ],
90              
91             =head1 METHODS
92              
93             Because this class is registered in @ISA of the project, the method can be used
94             directly from the object of the project.
95              
96             $project->view( ... );
97              
98             =head2 init_view
99              
100             When starting for the view, it initializes it.
101              
102             =head2 setup_view
103              
104             The setup for the view is done.
105              
106             =head2 view ([LABEL_STRING])
107              
108             The object of the specific view specified with LABEL_STRING is returned.
109              
110             When LABEL_STRING is omitted, the object of the view of default is restored.
111              
112             my $mason= $e->view;
113             or
114             my $mason= $e->view('mason');
115              
116             The setting of the first element set to the configuration becomes default.
117              
118             It is L<Egg::View::Mason> in the view. With L<Egg::View::HT> However, Ts belongs.
119              
120             =head2 is_view ([LABEL_STRING])
121              
122             If the view corresponding to LABEL_STRING can be used, true is returned.
123              
124             unless ($e->is_model('mason')) {
125             die q{ mason is not active. };
126             }
127              
128             =head1 HANDLER METHODS
129              
130             It is view manager's main body.
131              
132             L<Egg::Manager> is succeeded to and the main function is used.
133              
134             The method is called by way of view_manager.
135              
136             This class is succeeding to L<Egg::Manager> and it doesn't have a peculiar method.
137              
138             =head1 SEE ALSO
139              
140             L<Egg::Release>,
141             L<Egg::Manager>,
142             L<Egg::View::Mason>,
143             L<Egg::View::HT>,
144              
145             =head1 AUTHOR
146              
147             Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
148              
149             =head1 COPYRIGHT AND LICENSE
150              
151             Copyright (C) 2008 Bee Flag, Corp. E<lt>L<http://egg.bomcity.com/>E<gt>.
152              
153             This library is free software; you can redistribute it and/or modify
154             it under the same terms as Perl itself, either Perl version 5.8.6 or,
155             at your option, any later version of Perl 5 you may have available.
156              
157             =cut
158