Helper/Model/Redis.pm

filter: Statementstmt 65.2% 15 / 23 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 4 / 6 Podpod 100% 2 / 2 totaltotal 63.6% 21 / 33 CC 2 SCAR 6.2
CC
2
Cov
60%
mk_compclass
3.5
mk_comptest
2.0
BEGIN
1.0
CRAP 1.9
↑ Summary Model/Redis.pm »
1 package Catalyst::Helper::Model::Redis;
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  
6 1 our $VERSION = "0.02";
7 1 $VERSION = eval $VERSION;
8  
9 =head1 NAME
10  
11 Catalyst::Model::Redis - Redis Model Class
12  
13 =head1 VERSION
14  
15 0.01
16  
17 =head1 SYNOPSIS
18  
19 create model Redis Redis -- --host localhost --port 6379 --utf8
20  
21 =head1 USAAGE
22  
23 You can specify following configuration options:
24  
25 =over 4
26  
27 =item B<--host> I<hostname>
28  
29 =item B<--port> I<port>
30  
31 =item B<--database> I<db>
32  
33 =item B<--password> I<password>
34  
35 =item B<--lazy>
36  
37 =item B<--utf8>
38  
39 =back
40  
41 See description of options in L<RedisDB> documentation.
42  
43 =cut
44  
45 =head2 $self->mk_compclass
46  
47 Creates model class
48  
49 =cut
50  
51 1 ▶use Getopt::Long qw(GetOptionsFromArray);
Subroutine BEGIN: called CC=1 SCAR=0.0
52  
53 0 ▶sub mk_compclass {
Subroutine mk_compclass: not called CC=2 SCAR=12.6
Pod documented
54 0 my ( $class, $helper, @args ) = @_;
55 0 my %conf;
56 GetOptionsFromArray(
57 \@args,
58 "host=s" => \$conf{host},
59 "port=i" => \$conf{port},
60 "path=s" => \$conf{path},
61 "database=i" => \$conf{database},
62 "password=s" => \$conf{password},
63 "utf8" => \$conf{utf8},
64 "lazy" => \$conf{lazy},
65 0 ▶ ) or die "Invalid options for model";
Branch: 1 branch
BranchTrueFalseTotal
&GetOptionsFromArray(\@args, "host=s", \$conf{"host"}, "port=i", \$conf{"port"}, "path=s", \$conf{"path"}, "database=i", \$conf{"database"}, "password=s", \$conf{"password"}, "utf8", \$conf{"utf8"}, "lazy", \$conf{"lazy"}) or die "Invalid options for model" 0 0 0
66  
67 1 ▶ use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
68 0 warn Dumper [ \%conf ];
69 0 my $file = $helper->{file};
70 0 $helper->render_file( 'modelclass', $file, { conf => \%conf } );
71 }
72  
73 =head2 $self->mk_comptest
74  
75 creates test for model class
76  
77 =cut
78  
79 0 ▶sub mk_comptest {
Subroutine mk_comptest: not called CC=1 SCAR=6.9
Pod documented
80 0 my ( $self, $helper ) = @_;
81  
82 0 $helper->render_file( 'modeltest', $helper->{test} );
83 }
84  
85 1 1;
86  
87 =head1 SEE ALSO
88  
89 L<Catalyst>, L<RedisDB>
90  
91 =head1 BUGS
92  
93 Please report any bugs or feature requests via GitHub bug tracker at
94 L<http://github.com/trinitum/perl-Catalyst-Model-Redis/issues>.
95  
96 =head1 AUTHOR
97  
98 Pavel Shaydo C<< <zwon at cpan.org> >>
99  
100 =head1 LICENSE AND COPYRIGHT
101  
102 Copyright (C) 2012 Pavel Shaydo
103  
104 This program is free software; you can redistribute it and/or modify it
105 under the terms of either: the GNU General Public License as published
106 by the Free Software Foundation; or the Artistic License.
107  
108 See http://dev.perl.org/licenses/ for more information.
109  
110 =cut
111  
112 __DATA__
↑ Summary Model/Redis.pm »