blib/lib/CGI/Application/Pluggable.pm

filter: Statementstmt 67.6% 23 / 34 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod n/a totaltotal 61.7% 29 / 47 CC 5 SCAR 17.0
CC
5
Cov
58%
import
10.6
_mk_plugin_name
2.0
BEGIN
1.0
CRAP 5.5
↑ Summary
1 package CGI::Application::Pluggable;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use base 'CGI::Application';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use UNIVERSAL::require '0.10';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 our $VERSION = '0.03';
8  
9 1 ▶sub import {
Subroutine import: called CC=5 SCAR=23.6
10 1 my ( $self, @options ) = @_;
11 1 my $caller = caller(0);
12  
13 {
14 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 push @{"$caller\::ISA"}, $self;
16 }
17  
18 1 for my $option ( @options ) {
19 0 ▶ if ( ref $option eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $option eq 'HASH') { } 0 0 0
20 0 my ($plugin,$imports) = each(%{$option});
21 0 my $plaggable = $self->_mk_plugin_name($plugin);
22 0 ▶ $plaggable->use( @{$imports} ) or die $@;
Branch: 1 branch
BranchTrueFalseTotal
$plaggable->use(@{$imports;}) or die $@ 0 0 0
23 }
24 else {
25 0 my $plaggable = $self->_mk_plugin_name($option);
26 0 ▶ $plaggable->use or die $@;
Branch: 1 branch
BranchTrueFalseTotal
$plaggable->use or die $@ 0 0 0
27 }
28 }
29 }
30  
31 0 ▶sub _mk_plugin_name {
Subroutine _mk_plugin_name: not called CC=1 SCAR=6.9
32 0 my $self = shift;
33 0 my $name = shift;
34 0 return "CGI::Application::Plugin::$name";
35 }
36  
37 1 1;
38  
39 =head1 NAME
40  
41 CGI::Application::Pluggable - support to many plugin install.
42  
43 =head1 VERSION
44  
45 This documentation refers to CGI::Application::Pluggable version 0.03
46  
47 =head1 SYNOPSIS
48  
49 use CGI::Application::Pluggable
50 qw/TT LogDispatch DebugScreen Session Redirect Forward/,
51 {'Config::YAML' => [ qw/
52 config_file
53 config_param
54 config
55 / ]},
56 ;
57  
58 =head1 DESCRIPTION
59  
60 CAP::Pluggable is auto install many plugin.
61  
62 This only has to do use
63 though use base is done when CGI::Application is used usually.
64  
65 =head1 DEPENDENCIES
66  
67 L<strict>
68  
69 L<warnings>
70  
71 L<CGI::Application>
72  
73 =head1 BUGS AND LIMITATIONS
74  
75 There are no known bugs in this module.
76 Please report problems to Atsushi Kobayashi (E<lt>nekokak@cpan.orgE<gt>)
77 Patches are welcome.
78  
79 =head1 SEE ALSO
80  
81 L<strict>
82  
83 L<warnings>
84  
85 L<CGI::Application>
86  
87 =head1 AUTHOR
88  
89 Atsushi Kobayashi, E<lt>nekokak@cpan.orgE<gt>
90  
91 =head1 COPYRIGHT AND LICENSE
92  
93 Copyright (C) 2006 by Atsushi Kobayashi (E<lt>nekokak@cpan.orgE<gt>). All rights reserved.
94  
95 This library is free software; you can redistribute it and/or modify it
96 under the same terms as Perl itself. See L<perlartistic>.
97  
98 =cut
↑ Summary