Design/Controller/Feature.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 35 CC 2 SCAR 12.8
CC
2
Cov
0%
process
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.6
1 package WWW::Garden::Design::Controller::Feature;
2  
3 use Mojo::Base 'Mojolicious::Controller';
4  
5 use Data::Dumper::Concise; # For Dumper().
6  
7 use Moo;
8  
9 our $VERSION = '0.97';
10  
11 # -----------------------------------------------
12  
13 sub process
14 {
15 my($self) = @_;
16  
17 $self -> app -> log -> debug('Feature.process()');
18  
19 my($defaults) = $self -> app -> defaults;
20 my($item) = $self -> req -> params -> to_hash;
21  
22 $self -> app -> log -> debug("param($_) => $$item{$_}") for sort keys %$item;
23  
24 if ($$item{color_chosen} && $$item{name})
25 {
26 # In process_feature() all success branches print the raw message plus
27 # other information to the log, so nothing is printed here.
28  
29 my($packet) = $$defaults{db} -> process_feature($item);
30  
31 $self -> stash(json => $packet);
32 }
33 else
34 {
35 my($result) = {feature_id => 0, outcome => 'Error', raw => 'Missing color or feature name'};
36 my($packet) =
37 {
38 feature_table => $$defaults{db} -> read_features_table, # Warning: Not read_table('features').
39 message => $$defaults{db} -> format_raw_message($result),
40 };
41  
42 $self -> stash(json => $packet);
43 $self -> app -> log -> error($$result{raw});
44 }
45  
46 $self -> render;
47  
48 } # End of process.
49  
50 # -----------------------------------------------
51  
52 1;
53  
54 =pod
55  
56 =head1 NAME
57  
58 WWW::Garden::Design::Controller::Feature - Manage the 'flowers' database
59  
60 =head1 Machine-Readable Change Log
61  
62 The file Changes was converted into Changelog.ini by L<Module::Metadata::Changes>.
63  
64 =head1 Version Numbers
65  
66 Version numbers < 1.00 represent development versions. From 1.00 up, they are production versions.
67  
68 =head1 Repository
69  
70 L<https://github.com/ronsavage/WWW-Garden-Design>
71  
72 =head1 Support
73  
74 Email the author, or log a bug on RT:
75  
76 L<https://rt.cpan.org/Public/Dist/Display.html?Name=WWW::Garden::Design>.
77  
78 =head1 Author
79  
80 L<WWW::Garden::Design> was written by Ron Savage I<E<lt>ron@savage.net.auE<gt>> in 2014.
81  
82 My homepage: L<https://savage.net.au/>.
83  
84 =head1 Copyright
85  
86 Australian copyright (c) 2018, Ron Savage.
87  
88 All Programs of mine are 'OSI Certified Open Source Software';
89 you can redistribute them and/or modify them under the terms of
90 The Perl License, a copy of which is available at:
91 http://dev.perl.org/licenses/
92  
93 =cut