| 1 | package MYDan::Project::Apps; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | $|++; | ||
| 7 | |||
| 8 | use MYDan::Util::OptConf; | ||
| 9 | my %o; BEGIN{ %o = MYDan::Util::OptConf->load()->dump('project');}; | ||
| 10 | |||
| 11 | sub new | ||
| 12 | { | ||
| 13 | my ( $class, %self ) = @_; | ||
| 14 | |||
| 15 | die "name undef" unless $self{name}; | ||
| 16 | bless \%self, ref $class || $class; | ||
| 17 | } | ||
| 18 | |||
| 19 | sub ctrl | ||
| 20 | { | ||
| 21 | my ( $this, @ctrl, @result ) = @_; | ||
| 22 | die "ctrl name undef" unless @ctrl; | ||
| 23 | |||
| 24 | for my $ctrl ( @ctrl ) | ||
| 25 | { | ||
| 26 | |||
| 27 | my $file = "$o{apps}/$this->{name}/$ctrl"; | ||
| 28 | die "$this->{name} $ctrl undef" unless -f $file; | ||
| 29 | push @result, [ $ctrl, `cat '$file'`]; | ||
| 30 | } | ||
| 31 | return @result; | ||
| 32 | } | ||
| 33 | |||
| 34 | 1; |