« lib/App/SeismicUnixGui/developer/code/sunix/sunix_package_pod.pm
↑ Summary
lib/App/SeismicUnixGui/developer/code/sunix/sunix_package_tail.pm »
| 1 | package App::SeismicUnixGui::developer::code::sunix::sunix_package_subroutine; | ||
| 2 | use Moose; | ||
| 3 | our $VERSION = '0.0.1'; | ||
| 4 | |||
| 5 | |||
| 6 | =head2 encapsualted variables | ||
| 7 | |||
| 8 | =cut | ||
| 9 | |||
| 10 | my $sunix_package_subroutine = { | ||
| 11 | _package_name => '', | ||
| 12 | }; | ||
| 13 | |||
| 14 | =head2 Default perl lines for a subroutine | ||
| 15 | |||
| 16 | |||
| 17 | =cut | ||
| 18 | |||
| 19 | my @lines; | ||
| 20 | |||
| 21 | $lines[0] = ("\n"); | ||
| 22 | |||
| 23 | |||
| 24 | |||
| 25 | =head2 sub set_name | ||
| 26 | |||
| 27 | |||
| 28 | =cut | ||
| 29 | |||
| 30 | sub set_name { | ||
| 31 | |||
| 32 | my ($self,$name_href) = @_; | ||
| 33 | $sunix_package_subroutine->{_package_name} = $name_href; | ||
| 34 | # print("1. sunix_package_subroutine,name $name_href\n"); | ||
| 35 | |||
| 36 | } | ||
| 37 | |||
| 38 | |||
| 39 | =head2 sub set_package_name | ||
| 40 | |||
| 41 | |||
| 42 | =cut | ||
| 43 | |||
| 44 | sub set_package_name { | ||
| 45 | |||
| 46 | my ($self,$name_href) = @_; | ||
| 47 | $sunix_package_subroutine->{_package_name} = $name_href; | ||
| 48 | # print("1. sunix_package_subroutine,package_name $name_href\n"); | ||
| 49 | |||
| 50 | } | ||
| 51 | |||
| 52 | =head2 sub set_param_name_aref | ||
| 53 | |||
| 54 | print("sunix_package_subroutine,name,@lines\n"); | ||
| 55 | |||
| 56 | =cut | ||
| 57 | |||
| 58 | sub set_param_name_aref { | ||
| 59 | my ($self,$name_aref) = @_; | ||
| 60 | my ($first,$i,$package_name); | ||
| 61 | |||
| 62 | $package_name = $sunix_package_subroutine->{_package_name}; | ||
| 63 | |||
| 64 | $first = 1; | ||
| 65 | $i = $first; | ||
| 66 | |||
| 67 | $lines[$i] = (" sub $$name_aref {\n\n"); | ||
| 68 | $lines[++$i] = "\t".'my ( $self,$'.$$name_aref.' )'.("\t\t").'= @_;'.("\n"); | ||
| 69 | $lines[++$i] = "\t".'if ( $'.$$name_aref.' ne $empty_string ) {'.("\n\n"); | ||
| 70 | $lines[++$i] = "\t\t".'$'.$package_name.'->{_'.$$name_aref.'}'.("\t\t").'= $'.$$name_aref.';'.("\n"); | ||
| 71 | $lines[++$i] = "\t\t".'$'.$package_name.'->{_note}'.("\t\t").'= $'.$package_name.'->{_note}.'.'\' '. $$name_aref.'=\'.$'.$package_name.'->{_'.$$name_aref.'};'.("\n") ; | ||
| 72 | $lines[++$i] = "\t\t".'$'.$package_name.'->{_Step}'.("\t\t").'= $'.$package_name.'->{_Step}.'.'\' '. $$name_aref.'=\'.$'.$package_name.'->{_'.$$name_aref.'};'.("\n\n"); | ||
| 73 | $lines[++$i] = "\t".'} else { '."\n"; | ||
| 74 | $lines[++$i] = "\t\t".'print("'.$package_name.', '.$$name_aref.', missing '.$$name_aref.',\n");'."\n"; | ||
| 75 | $lines[++$i] = "\t".' }'."\n"; | ||
| 76 | $lines[++$i] = ' }'."\n\n"; | ||
| 77 | |||
| 78 | # print("sunix_packge_subroutine, set_param_name_aref, lines= @lines \n"); | ||
| 79 | |||
| 80 | return(); | ||
| 81 | } | ||
| 82 | |||
| 83 | =head2 sub section | ||
| 84 | |||
| 85 | print("sunix_package_subroutine,section,@lines\n"); | ||
| 86 | |||
| 87 | =cut | ||
| 88 | |||
| 89 | sub section { | ||
| 90 | my ($self) = @_; | ||
| 91 | return (\@lines); | ||
| 92 | } | ||
| 93 | |||
| 94 | 1; |