Permalink
Browse files

Allow a literal to be undef (#54)

There's no reason this should not be allowed.
  • Loading branch information...
1 parent f8e1409 commit 1f489aacb6d00275bb35c1bae30d85fb749b1890 @autarch autarch committed with Sep 8, 2016
Showing with 6 additions and 3 deletions.
  1. +3 −2 Changes
  2. +0 −1 lib/Bread/Board/Literal.pm
  3. +3 −0 t/024_sugar.t
View
@@ -10,8 +10,9 @@ Revision history for Bread-Board
[ DOCUMENTATION ]
[ ENHANCEMENTS ]
- - Bread::Board::Dumper now sorts services and sub containers - previously
- these came out in a random order each time (#56, Dave Rolsky)
+ - Bread::Board::Dumper now sorts services and sub containers - previously
+ these came out in a random order each time (#56, Dave Rolsky)
+ - allow a service or literal to be undefined. (#54, Dave Rolsky)
[ NEW FEATURES ]
@@ -7,7 +7,6 @@ with 'Bread::Board::Service';
has 'value' => (
is => 'rw',
- isa => 'Defined',
required => 1,
);
View
@@ -46,6 +46,7 @@ my $c = container 'MyApp' => as {
service 'dsn' => "dbi:sqlite:dbname=my-app.db";
service 'username' => "user";
service 'password' => "pass";
+ service 'host' => undef;
service 'dbh' => (
block => sub {
@@ -78,6 +79,8 @@ is($logger->log_file, 'logfile.log', '... got the right logfile dep');
is($c->fetch('logger/log_file')->service, $c->fetch('log_file'), '... got the right value');
is($c->fetch('logger/log_file')->get, 'logfile.log', '... got the right value');
+is($c->resolve( service => 'Database/host'), undef, '... service where value is undef');
+
my $dbh = $c->resolve( service => 'Database/dbh' );
isa_ok($dbh, 'DBI');

0 comments on commit 1f489aa

Please sign in to comment.