extends 'Bread::Board::Container';
+has flags => (
+ is => 'ro',
+ isa => 'ArrayRef',
+ default => sub { [] },
+);
+
has config_local_suffix => (
is => 'ro',
isa => 'Str',
config_local_suffix
config_path
locate_components
+ flags
home
root_dir
/;
);
}
+sub build_flags_service {
+ my $self = shift;
+
+ return Bread::Board::Literal->new(
+ lifecycle => 'Singleton',
+ name => 'flags',
+ value => $self->get_flags,
+ );
+}
+
+sub get_flags {
+ my $self = shift;
+ my $flags = {};
+
+ foreach (@{ $self->flags }) {
+ if (/^-Debug$/) {
+ $flags->{log} =
+ ( $flags->{log} ) ? 'debug,' . $flags->{log} : 'debug';
+ }
+ elsif (/^-(\w+)=?(.*)$/) {
+ $flags->{ lc $1 } = $2;
+ }
+ else {
+ push @{ $flags->{plugins} }, $_;
+ }
+ }
+
+ return $flags;
+}
+
sub build_home_service {
my $self = shift;
return $env;
}
- if ( my $home = $self->param('home_flag') ) {
+ if ( my $home = $self->param('flags')->{home} ) {
return $home;
}
return Catalyst::Utils::home($class);
},
- parameters => {
- home_flag => { is => 'ro', isa => 'Str|Undef', required => 0 }
- },
- dependencies => [ depends_on('catalyst_application') ],
+ dependencies => [ depends_on('flags'), depends_on('catalyst_application') ],
);
}