lib/App/SeismicUnixGui/developer/code/sunix/sunix_package_clear.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 42 CC 3 SCAR 15.4
CC
3
Cov
0%
set_param_names
6.0
set_package_name
6.0
get_section
2.0
CRAP 4.7
1 package App::SeismicUnixGui::developer::code::sunix::sunix_package_clear;
2  
3 use Moose;
4 our $VERSION = '0.0.1';
5  
6 my @lines;
7  
8 =head2 encapsulated variables
9  
10 =cut
11  
12 my $sunix_package_clear = {
13 _package_name => '',
14 _param_names => '',
15 };
16  
17 =head2 sub set_param_names
18  
19 print("sunix_package_clear,name,@lines\n");
20  
21 =cut
22  
23 sub set_param_names {
24 my ( $self, $name_aref ) = @_;
25  
26 my ( $first, $last, $i, $package_name );
27  
28 if ($name_aref) {
29  
30 # print("sunix_package_clear,set_param_names, @{$name_aref}\n");
31 $sunix_package_clear->{_set_param_names} = $name_aref;
32 $package_name = $sunix_package_clear->{_package_name};
33  
34 # print("sunix_package_clear,set_param_names, $package_name\n");
35  
36 my $length = scalar @$name_aref;
37 $lines[0] = "";
38 $lines[1] = (" sub clear") . " {\n\n";
39  
40 for ( $i = 2, my $j = 0 ; $j < $length ; $i++, $j++ ) {
41 $lines[$i] =
42 "\t\t" . '$'
43 . $package_name . '->{_'
44 . @$name_aref[$j] . '}'
45 . "\t\t\t"
46 . '= \'\';'
47 . ("\n");
48 }
49  
50 $lines[$i] =
51 "\t\t" . '$'
52 . $package_name
53 . '->{_Step}'
54 . "\t\t\t"
55 . '= \'\';'
56 . ("\n");
57 $lines[ ++$i ] =
58 "\t\t" . '$'
59 . $package_name
60 . '->{_note}'
61 . "\t\t\t"
62 . '= \'\';'
63 . ("\n");
64 $lines[ ++$i ] = ' }' . ("\n");
65 $lines[ ++$i ] = ("\n");
66  
67 }
68 else {
69 print(
70 "sunix_package_clear,set_param_names, missing parameter names \n");
71 }
72  
73 }
74  
75 =head2 sub set_package_name
76  
77 print("sunix_package_clear,name,@lines\n");
78  
79 =cut
80  
81 sub set_package_name {
82  
83 my ( $self, $name_href ) = @_;
84  
85 if ($name_href) {
86  
87 #print("sunix_package_clear,set_package_name as: $name_href \n");
88 $sunix_package_clear->{_package_name} = $name_href;
89  
90 }
91 else {
92 print("sunix_package_clear,set_package_name, mising package name \n");
93 }
94  
95 return ();
96 }
97  
98 =head2 sub get_section
99  
100 print("sunix_package_clear,get_section,@lines\n");
101  
102 =cut
103  
104 sub get_section {
105 my ($self) = @_;
106 return ( \@lines );
107 }
108  
109 1;