Generate/Class.pm untested

filter: Statementstmt 0.0% 0 / 37 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 41 CC 1 SCAR 6.9
CC
1
Cov
0%
generate
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Daje::Workflow::GeneratePerl::Generate::Class;
2 use Mojo::Base 'Daje::Workflow::GeneratePerl::Base::Common' ,-base, -signatures;
3  
4 use String::CamelCase qw(camelize);
5  
6 # NAME
7 # ====
8 #
9 # Daje::Workflow::GeneratePerl::Generate::Class - Create class
10 #
11 #
12 # REQUIRES
13 # ========
14 #
15 # use String::CamelCase
16 #
17 #
18 #
19 # METHODS
20 # =======
21 #
22 #
23  
24 our $VERSION = '0.01';
25  
26 has 'methods';
27 has 'fields';
28 has 'config';
29  
30 sub generate($self) {
31 my $tpl = $self->templates->get_data_section('class');
32 my $table_name = $self->json->{table_name};
33 my $name_space = $self->context->{context}->{perl}->{name_space};
34 my $base_name_space = $self->context->{context}->{perl}->{base_name_space};
35 my $class_name = camelize($table_name);
36 my $base_class_name = "Base";
37  
38 my $select_fields = $self->methods->select_fields();
39 my $pkey = $self->methods->pkey();
40 my $fkey = $self->methods->fkey();
41 my $insert = $self->methods->insert();
42 my $update = $self->methods->update();
43 my $select_method = $self->methods->select_method();
44 my $select_from_index = $self->methods->select_index_method();
45  
46 my $date = localtime();
47  
48 $tpl =~ s/<<date>>/$date/ig;
49 $tpl =~ s/<<fields>>/$select_fields/ig;
50 $tpl =~ s/<<name_space>>/$name_space/ig;
51 $tpl =~ s/<<classname>>/$class_name/ig;
52 $tpl =~ s/<<base_name_space>>/$base_name_space/ig;
53 $tpl =~ s/<<base_class_name>>/$base_class_name/ig;
54  
55 $tpl =~ s/<<pkey>>/$pkey/ig;
56 $tpl =~ s/<<fkey>>/$fkey/ig;
57 $tpl =~ s/<<insert>>/$insert/ig;
58 $tpl =~ s/<<update>>/$update/ig;
59  
60 $tpl =~ s/<<select>>/$select_method/ig;
61 $tpl =~ s/<<methods>>/$select_from_index/ig;
62  
63 return $tpl;
64 }
65 1;
66  
67  
68 #################### pod generated by Pod::Autopod - keep this line to make pod updates possible ####################
69  
70 =head1 NAME
71  
72  
73 Daje::Workflow::GeneratePerl::Generate::Class - Create class
74  
75  
76  
77  
78 =head1 REQUIRES
79  
80  
81 use String::CamelCase
82  
83  
84  
85  
86  
87 =head1 METHODS
88  
89  
90  
91  
92  
93 =cut
94