You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
I'm surprised it doesn't work, but it wouldn't be terribly difficult to add. It'd be another option in create_service. Presently only $class, $extends, and $value are allowed to define services, but adding $ref makes sense.
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:
With the following output:
Is what I'm asking for possible?
The text was updated successfully, but these errors were encountered: