File Coverage

lib/Egg/View.pm
Criterion Covered Total %
statement 12 16 75.0
branch n/a
condition 0 3 0.0
subroutine 4 5 80.0
pod 1 1 100.0
total 17 25 68.0


line stmt bran cond sub pod time code
1             package Egg::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   6691 use strict;
  1         2  
  1         53  
8 1     1   5 use warnings;
  1         3  
  1         41  
9 1     1   5 use base qw/ Egg::Base /;
  1         3  
  1         99  
10 1     1   5 use Carp qw/ croak /;
  1         1  
  1         233  
11              
12             our $VERSION= '3.00';
13              
14             sub template {
15 0     0 1   my $e= shift->e;
16 0   0       my $template= $e->template || do {
17             my $path= join('/', @{$e->action}) || do {
18             $e->debug_out(__PACKAGE__. q{ - $e->template is empty. });
19             return do { $e->finished('404 Not Found'); (undef) };
20             };
21             "$path.". $e->config->{template_extention};
22             };
23 0           $e->debug_out("# + template file : $template");
24 0           $template;
25             }
26              
27             1;
28              
29             __END__
30              
31             =head1 NAME
32              
33             Egg::View - Base class for view.
34              
35             =head1 DESCRIPTION
36              
37             It is a base class for the view component.
38              
39             This module has succeeded to L<Egg::Base>.
40              
41             =head1 METHODS
42              
43             =head2 template
44              
45             If this is undefined, passing and the file name of the template are generated
46             from $e-E<gt>action though $e-E<gt>template is returned.
47             And, when the template is not obtained from $e-E<gt>action,
48             it is $e-E<gt>finished(404) and undefined is returned.
49              
50             my $template= $e->view->template || return 0;
51              
52             =head1 SEE ALSO
53              
54             L<Egg::Release>,
55             L<Egg::Base>,
56              
57             =head1 AUTHOR
58              
59             Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
60              
61             =head1 COPYRIGHT AND LICENSE
62              
63             Copyright (C) 2008 Bee Flag, Corp. E<lt>L<http://egg.bomcity.com/>E<gt>.
64              
65             This library is free software; you can redistribute it and/or modify
66             it under the same terms as Perl itself, either Perl version 5.8.6 or,
67             at your option, any later version of Perl 5 you may have available.
68              
69             =cut
70