Beam::Service - Role for services to access Beam::Wire features
version 0.001
package My::Object;
use Role::Tiny::With; # or Moo, or Moose
with 'Beam::Service';
package main;
use Beam::Wire;
my $wire = Beam::Wire->new(
config => {
my_object => {
'$class' => 'My::Object',
},
},
);
print $wire->get( 'my_object' )->name; # my_object
This role adds extra functionality to an object that is going to be used as a service in a Beam::Wire container. While any object can be configured with Beam::Wire, consuming the Beam::Service role allows an object to know its own name and to access the container it was configured in to fetch other objects that it needs.
The name of the service. This is the name used in the Beam::Wire configuration file for this service.
The Beam::Wire container object that contained this service. Using this container we can get other services as-needed.
Doug Bell preaction@cpan.org
This software is copyright (c) 2017 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
