« blib/lib/auto/share/dist/Cmd-Dwarf/app/lib/App/Controller/ApiBase.pm
↑ Summary
blib/lib/auto/share/dist/Cmd-Dwarf/app/script/generate.pl »
| 1 | package Dwarf::Module; | ||
| 2 | use Dwarf::Pragma; | ||
| 3 | use Dwarf::Module::DSL; | ||
| 4 | use Dwarf::Util qw/load_class dwarf_log/; | ||
| 5 | use Scalar::Util qw/weaken/; | ||
| 6 | |||
| 7 | use Dwarf::Accessor { | ||
| 8 | ro => [qw/context dsl/], | ||
| 9 | rw => [qw/prefix/] | ||
| 10 | }; | ||
| 11 | |||
| 12 | sub _build_prefix { shift->context->namespace . '::Model' } | ||
| 13 | |||
| 14 | sub _build_dsl { | ||
| 15 | my $self = shift; | ||
| 16 | my $dsl = Dwarf::Module::DSL->new( | ||
| 17 | context => $self->context, | ||
| 18 | module => $self, | ||
| 19 | ); | ||
| 20 | weaken $dsl->{context}; | ||
| 21 | weaken $dsl->{module}; | ||
| 22 | return $dsl; | ||
| 23 | } | ||
| 24 | |||
| 25 | sub new { | ||
| 26 | my $class = shift; | ||
| 27 | my $self = bless { @_ }, $class; | ||
| 28 | dwarf_log 'new Module'; | ||
| 29 | $self->dsl->export_symbols($class); | ||
| 30 | return $self; | ||
| 31 | } | ||
| 32 | |||
| 33 | sub DESTROY { | ||
| 34 | my $self = shift; | ||
| 35 | dwarf_log 'DESTROY Module'; | ||
| 36 | if (defined $self->{dsl}) { | ||
| 37 | $self->dsl->delete_symbols(ref $self); | ||
| 38 | } | ||
| 39 | } | ||
| 40 | |||
| 41 | sub init {} | ||
| 42 | |||
| 43 | sub on_error {} | ||
| 44 | |||
| 45 | 1; |