« lib/App/SeismicUnixGui/developer/code/sunix/sunix_package_declaration.pm
↑ Summary
lib/App/SeismicUnixGui/developer/code/sunix/sunix_package_instantiation.pm »
| 1 | package App::SeismicUnixGui::developer::code::sunix::sunix_package_encapsulated; | ||
| 2 | use Moose; | ||
| 3 | our $VERSION = '0.0.1'; | ||
| 4 | |||
| 5 | my @lines; | ||
| 6 | |||
| 7 | =head2 encapsulated variables | ||
| 8 | |||
| 9 | =cut | ||
| 10 | |||
| 11 | my $sunix_package_encapsulated = { | ||
| 12 | _package_name => '', | ||
| 13 | _subroutine_name => '', | ||
| 14 | _param_names => '', | ||
| 15 | }; | ||
| 16 | |||
| 17 | =head2 sub set_param_names | ||
| 18 | |||
| 19 | [$i] | ||
| 20 | |||
| 21 | |||
| 22 | =cut | ||
| 23 | |||
| 24 | sub set_param_names{ | ||
| 25 | my ($self,$name_aref) = @_; | ||
| 26 | my ($first,$last,$i,$package_name); | ||
| 27 | |||
| 28 | use App::SeismicUnixGui::misc::control '0.0.3'; | ||
| 29 | use aliased 'App::SeismicUnixGui::misc::control'; | ||
| 30 | |||
| 31 | # my $control = control->new(); | ||
| 32 | |||
| 33 | # $control ->set_infection($name_aref); | ||
| 34 | # $name_aref = $control->get_no_double_hyphen(); | ||
| 35 | |||
| 36 | $sunix_package_encapsulated->{_param_names} = $name_aref; | ||
| 37 | $package_name = $sunix_package_encapsulated->{_package_name}; | ||
| 38 | my $length = scalar @$name_aref; | ||
| 39 | @lines = []; # clear all memory from prior lines | ||
| 40 | # print("sunix_package_encapsulated,set_param_names,length:$length\n"); | ||
| 41 | $lines[0] = ("\n"); | ||
| 42 | $lines[1] = ("my ").'$'.$package_name."\t\t\t".'= '."{\n"; | ||
| 43 | |||
| 44 | for ($i=2, my $j=0; $j < $length ; $i++,$j++) { | ||
| 45 | $lines[$i] = "\t".'_'.@$name_aref[$j]."\t\t\t\t\t".'=> \'\','.("\n"); | ||
| 46 | } | ||
| 47 | $lines[$i] = "\t".'_Step'."\t\t\t\t\t".'=> \'\','.("\n"); | ||
| 48 | $lines[++$i] = "\t".'_note'."\t\t\t\t\t".'=> \'\','.("\n\n"); | ||
| 49 | $lines[++$i] = '};'.("\n"); | ||
| 50 | $lines[++$i] = ("\n"); | ||
| 51 | } | ||
| 52 | |||
| 53 | |||
| 54 | =head2 sub set_package_name | ||
| 55 | |||
| 56 | =cut | ||
| 57 | |||
| 58 | sub set_package_name { | ||
| 59 | my ($self,$name_href) = @_; | ||
| 60 | $sunix_package_encapsulated->{_package_name} = $name_href; | ||
| 61 | # print("sunix_package_encapsulated,set_package_name,$sunix_package_encapsulated->{_package_name}\n"); | ||
| 62 | return(); | ||
| 63 | } | ||
| 64 | |||
| 65 | |||
| 66 | =head2 sub set_package_name_href | ||
| 67 | |||
| 68 | =cut | ||
| 69 | |||
| 70 | sub set_package_name_href { | ||
| 71 | my ($self,$name_href) = @_; | ||
| 72 | $sunix_package_encapsulated->{_package_name} = $name_href; | ||
| 73 | # print("sunix_package_encapsulated,set_package_name,$sunix_package_encapsulated->{_package_name}\n"); | ||
| 74 | return(); | ||
| 75 | } | ||
| 76 | |||
| 77 | |||
| 78 | =head2 sub get_section | ||
| 79 | |||
| 80 | print("sunix_package_encapsulated,get_section,@lines\n"); | ||
| 81 | |||
| 82 | =cut | ||
| 83 | |||
| 84 | sub get_section { | ||
| 85 | my ($self) = @_; | ||
| 86 | # print("sunix_package_encapsulated,get_section, lines: @lines\n"); | ||
| 87 | return (\@lines); | ||
| 88 | } | ||
| 89 | |||
| 90 | 1; |