File Coverage

lib/Authen/Quiz/FW.pm
Criterion Covered Total %
statement 29 30 96.6
branch 2 4 50.0
condition n/a
subroutine 8 9 88.8
pod 1 1 100.0
total 40 44 90.9


line stmt bran cond sub pod time code
1             package Authen::Quiz::FW;
2             #
3             # Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
4             #
5             # $Id: FW.pm 362 2008-08-18 18:34:11Z lushe $
6             #
7 3     3   1593 use strict;
  3         8  
  3         102  
8 3     3   15 use warnings;
  3         91  
  3         88  
9 3     3   3027 use Class::C3;
  3         11594  
  3         18  
10 3     3   2691 use UNIVERSAL::require;
  3         5089  
  3         29  
11 3     3   1066 use Authen::Quiz;
  3         9  
  3         43  
12              
13             our $VERSION= '0.01';
14              
15             our @ISA;
16              
17             my @plugins;
18 0     0 1 0 sub plugins { \@plugins }
19              
20             sub import {
21 2     2   20 my $class= shift;
22 2         6 for (@_) {
23 1 50       6 my $pkg= /^\+(.+)/ ? $1: "Authen::Quiz::Plugin::$_";
24 1         2 push @plugins, $pkg;
25 1         22 push @ISA, $pkg;
26             }
27 2         54 push @ISA, 'Authen::Quiz';
28 2         54 push @ISA, 'Authen::Quiz::FW::Base';
29 2 50       9 for my $load (@plugins) { $load->require || die __PACKAGE__. " - $@" }
  1         10  
30 2         39 $class->_setup;
31             }
32              
33             package Authen::Quiz::FW::Base;
34 3     3   663 use strict;
  3         7  
  3         168  
35 2     2   9 sub _setup { @_ }
36              
37             1;
38              
39             __END__
40              
41             =head1 NAME
42              
43             Authen::Quiz::FW - Framework for Authen::Quiz.
44              
45             =head1 SYNOPSIS
46              
47             use Authen::Quiz::FW qw/ JS Memcached /;
48            
49             my $q= Authen::Quiz::FW->new(
50             data_folder => '/path/to/authen_quiz',
51             memcached => { ...... },
52             );
53            
54             my $js_source= $q->question2js('boxid');
55              
56             =head1 DESCRIPTION
57              
58             The framework for L<Authen::Quiz> makes the plugin available.
59              
60             If use passes the list of the plugin at the time of reading Authen::Quiz::FW, it becomes available.
61              
62             use Authen::Quiz::FW qw/ JS Memcached /;
63              
64             L<Authen::Quiz::Plugin::JS> and L<Authen::Quiz::Plugin::Memcached> was enclosed as a standard plugin.
65              
66             =head1 METHODS
67              
68             =head2 plugins
69              
70             The list of the read plug-in is returned.
71              
72             =head1 SEE ALSO
73              
74             L<Authen::Quiz>,
75             L<UNIVERSAL::require>,
76             L<Class::C3>,
77              
78             L<http://egg.bomcity.com/wiki?Authen%3a%3aQuiz>,
79              
80             =head1 AUTHOR
81              
82             Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
83              
84             =head1 COPYRIGHT AND LICENSE
85              
86             Copyright (C) 2008 by Bee Flag, Corp. E<lt>http://egg.bomcity.com/E<gt>.
87              
88             This library is free software; you can redistribute it and/or modify
89             it under the same terms as Perl itself, either Perl version 5.8.8 or,
90             at your option, any later version of Perl 5 you may have available.
91              
92             =cut