| 1 | package Daje::Workflow::GeneratePerl::Generate::Interface; | ||
| 2 | use Mojo::Base 'Daje::Workflow::GeneratePerl::Base::Common' ,-base, -signatures; | ||
| 3 | |||
| 4 | use String::CamelCase qw(camelize); | ||
| 5 | |||
| 6 | |||
| 7 | our $VERSION = '0.01'; | ||
| 8 | has 'name_space'; | ||
| 9 | has 'table' ; | ||
| 10 | has 'name_interface'; | ||
| 11 | has 'interface_space_dir'; | ||
| 12 | |||
| 13 | sub generate($self) { | ||
| 14 | $self->table(camelize($self->table)); | ||
| 15 | |||
| 16 | my $tpl = $self->templates->get_data_section('interface'); | ||
| 17 | my $name_space = $self->context->{context}->{perl}->{$self->name_space()}; | ||
| 18 | my $interface = $self->context->{context}->{perl}->{$self->name_interface()}; | ||
| 19 | my $date = localtime(); | ||
| 20 | my $table = $self->table(); | ||
| 21 | |||
| 22 | $tpl =~ s/<<date>>/$date/ig; | ||
| 23 | $tpl =~ s/<<interface>>/$interface/ig; | ||
| 24 | $tpl =~ s/<<classname>>/$table/ig; | ||
| 25 | $tpl =~ s/<<name_space>>/$name_space/ig; | ||
| 26 | |||
| 27 | my $data->{file} = $self->context->{context}->{perl}->{$self->interface_space_dir} . "$table.pm"; | ||
| 28 | $data->{data} = $tpl; | ||
| 29 | $data->{only_new} = 1; | ||
| 30 | $data->{path} = 1; | ||
| 31 | push(@{$self->context->{context}->{perlfiles}}, $data); | ||
| 32 | } | ||
| 33 | |||
| 34 | 1; | ||
| 35 | |||
| 36 | |||
| 37 | #################### pod generated by Pod::Autopod - keep this line to make pod updates possible #################### | ||
| 38 | |||
| 39 | =head1 NAME | ||
| 40 | |||
| 41 | Daje::Workflow::GeneratePerl::Generate::Interface | ||
| 42 | |||
| 43 | |||
| 44 | =head1 DESCRIPTION | ||
| 45 | |||
| 46 | pod generated by Pod::Autopod - keep this line to make pod updates possible #################### | ||
| 47 | |||
| 48 | |||
| 49 | =head1 REQUIRES | ||
| 50 | |||
| 51 | L<String::CamelCase> | ||
| 52 | |||
| 53 | L<Mojo::Base> | ||
| 54 | |||
| 55 | |||
| 56 | =head1 METHODS | ||
| 57 | |||
| 58 | =head2 generate($self) | ||
| 59 | |||
| 60 | generate($self)(); | ||
| 61 | |||
| 62 | |||
| 63 | =cut | ||
| 64 |