Toader/Render/supportedBackends.pm

filter: Statementstmt 41.4% 17 / 41 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 100% 2 / 2 totaltotal 42.8% 24 / 56 CC 4 SCAR 21.6
CC
4
Cov
36%
checkBE
20.0
new
2.0
BEGIN
1.0
CRAP 8.7
« Toader/Templates/Defaults.pm ↑ Summary Toader/Render/supportedObjects.pm »
1 package Toader::Render::supportedBackends;
2  
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use base 'Error::Helper';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Toader::Render::supportedObjects;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Module::List qw(list_modules);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 =head1 NAME
10  
11 Toader::Render::supportedBackends - This checks if the backend is supported or not.
12  
13 =head1 VERSION
14  
15 Version 0.1.0
16  
17 =cut
18  
19 1 our $VERSION = '0.1.0';
20  
21 =head1 SYNOPSIS
22  
23 =head1 METHODS
24  
25 =head2 new
26  
27 This initiates the object.
28  
29 There is no reason to check for any errors
30 as this module will not throw any errors
31 upon initilization.
32  
33 my $foo=Toader::Render::supportedBackends->new;
34  
35 =cut
36  
37 0 ▶sub new{
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
38 0 my $self={
39 error=>undef,
40 errorString=>'',
41 perror=>undef,
42 soc=>Toader::Render::supportedObjects->new,
43 errorExtra=>{
44 flags=>{
45 1=>'noObj',
46 2=>'unsupportedObj',
47 },
48 },
49 };
50 0 bless $self;
51  
52 0 return $self;
53 }
54  
55 =head2 checkBE
56  
57 This checks if the specified for the object exists or not.
58  
59 One argument is required and that is the object to check.
60  
61 my $results=$foo->checkBE( $obj );
62 if ( $foo->error ){
63 warn( 'Error:'.$foo->error.': '.$foo->errorString );
64 }else{
65 if ( $results ){
66 print "It is supported.\n";
67 }
68 }
69  
70 =cut
71  
72 0 ▶sub checkBE{
Subroutine checkBE: not called CC=4 SCAR=30.0
Pod documented
73 0 my $self=$_[0];
74 0 my $obj=$_[1];
75  
76 0 $self->errorblank;
77  
78 0 ▶ if ( ! defined( $obj ) ){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $obj) 0 0 0
79 0 $self->{error}=1;
80 0 $self->{errorString}='No object defined';
81 0 $self->warn;
82 0 return undef;
83 }
84  
85 0 ▶ if ( ! $self->{soc}->isSupported( $obj ) ){
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"soc"}->isSupported($obj)) 0 0 0
86 0 $self->{error}=2;
87 0 $self->{errorString}='"'.ref($obj).'" is not a supported object';
88 0 $self->warn;
89 0 return undef;
90 }
91  
92 #get what should be rendered
93 0 my $renderUsing=$obj->renderUsing;
94 0 my %modules=list_modules( $renderUsing.'::', { list_modules=>1 } );
95
96 #get the renderer
97 0 my $renderer=undef;
98 0 $renderer=$obj->rendererGet;
99 0 ▶ if ( $obj->error ){
Branch: 1 branch
BranchTrueFalseTotal
if ($obj->error) 0 0 0
100 0 $self->{error}=3;
101 0 $self->{errorString}='The object, "'.ref($obj).'", errored. error="'.
102 $obj->error.'" errorString="'.$obj->errorString.'"';
103 0 return undef;
104 }
105  
106 }
107  
108 =head1 ERROR CODES
109  
110 =head2 1, noObj
111  
112 No object defined.
113  
114 =head2 2, unsupportedObj
115  
116 Unsupported object type.
117  
118 =head1 AUTHOR
119  
120 Zane C. Bowers-Hadley, C<< <vvelox at vvelox.net> >>
121  
122 =head1 BUGS
123  
124 Please report any bugs or feature requests to C<bug-toader at rt.cpan.org>, or through
125 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Toader>. I will
126 be notified, and then you'll automatically be notified of progress on your bug as I make
127 changes.
128  
129 =head1 SUPPORT
130  
131 You can find documentation for this module with the perldoc command.
132  
133 perldoc Toader::Render::supportedBackends
134  
135 You can also look for information at:
136  
137 =over 4
138  
139 =item * RT: CPAN's request tracker
140  
141 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Toader>
142  
143 =item * AnnoCPAN: Annotated CPAN documentation
144  
145 L<http://annocpan.org/dist/Toader>
146  
147 =item * CPAN Ratings
148  
149 L<http://cpanratings.perl.org/d/Toader>
150  
151 =item * Search CPAN
152  
153 L<http://search.cpan.org/dist/Toader/>
154  
155 =back
156  
157 =head1 ACKNOWLEDGEMENTS
158  
159 =head1 LICENSE AND COPYRIGHT
160  
161 Copyright 2013. Zane C. Bowers-Hadley.
162  
163 This program is free software; you can redistribute it and/or modify it
164 under the terms of either: the GNU General Public License as published
165 by the Free Software Foundation; or the Artistic License.
166  
167 See http://dev.perl.org/licenses/ for more information.
168  
169 =cut
170  
171 1 1; # End of Toader::Render::supportedBackends
« Toader/Templates/Defaults.pm ↑ Summary Toader/Render/supportedObjects.pm »