-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Hi,
I'm like to create a bare service via a reference which returns a scalar. I can't seem to be able to come up with a configuration that works. Here's some code and a configuration:
use strict;
use warnings;
use Data::Dumper;
use Beam::Wire;
package Class {
sub new { return bless {}, $_[0] }
sub time { return 20 }
}
$INC{'Class.pm'} = 'Class.pm'; # so module looks like it's been loaded.
my %call = (
'$ref' => 'evt2data',
'$call' => 'time',
);
my %config = (
'evt2data' => {
'class' => 'Class',
},
'time' => [ { %call } ],
'time1' => { %call },
'time2' => { value => { %call } },
);
my $wire = Beam::Wire->new( config => \%config );
for my $service ( qw[ time time1 time2 ] ) {
eval { say Dumper( $wire->get( $service ) ) }
or say STDERR $@;
}
With the following output:
$VAR1 = [
20
];
Invalid config for service 'time1': Service configuration incomplete. Missing one of "class", "value", "config"
$VAR1 = {
'$ref' => 'evt2data',
'$call' => 'time'
};
Is what I'm asking for possible?
Metadata
Metadata
Assignees
Labels
No labels