NAME
Aion::Pleroma - container of aeons
SYNOPSIS
use Aion::Pleroma;
my $pleroma = Aion::Pleroma->new;
$pleroma->get('user') # -> undef
$pleroma->resolve('user') # @-> user is'nt eon!
DESCRIPTION
Implements the dependency container pattern.
An eon is created when requesting from a container via the get or resolve method, or via the eon aspect as a lazy default. Laziness can be canceled via the lazy aspect.
The container is in the $Aion::pleroma variable and can be replaced with local.
The configuration for creating eons is obtained from the PLEROMA config and the annotation file (created by the Aion::Annotation package). The annotation file can be replaced via the INI config.
FEATURES
ini
Annotation file.
Aion::Pleroma->new->ini # => etc/annotation/eon.ann
pleroma
Configuration: key => 'class#class_method'.
File lib/Ex/Eon/AnimalEon.pm:
package Ex::Eon::AnimalEon;
#@eon
use common::sense;
use Aion;
has role => (is => 'ro');
#@eon ex.cat
sub cat { __PACKAGE__->new(role => 'cat') }
#@eon
sub dog { __PACKAGE__->new(role => 'dog') }
1;
File etc/annotation/eon.ann:
Ex::Eon::AnimalEon#,2=
Ex::Eon::AnimalEon#cat,10=ex.cat
Ex::Eon::AnimalEon#dog,13=Ex::Eon::AnimalEon#dog
Aion::Pleroma->new->pleroma # --> {"Ex::Eon::AnimalEon" => "Ex::Eon::AnimalEon#new", "Ex::Eon::AnimalEon#dog" => "Ex::Eon::AnimalEon#dog", "ex.cat" => "Ex::Eon::AnimalEon#cat", "Aion::Pleroma" => "Aion::Pleroma#new"}
eon
The totality of generated eons.
my $pleroma = Aion::Pleroma->new;
$pleroma->eon # --> { "Aion::Pleroma" => $pleroma }
my $cat = $pleroma->resolve('ex.cat');
$pleroma->eon # --> { "ex.cat" => $cat, "Aion::Pleroma" => $pleroma }
SUBROUTINES
get ($key)
Receive an eon from the container.
my $pleroma = Aion::Pleroma->new;
$pleroma->get('') # -> undef
$pleroma->get('Ex::Eon::AnimalEon#dog')->role # => dog
resolve ($key)
Get an eon from the container or an exception if it is not there.
my $pleroma = Aion::Pleroma->new;
$pleroma->resolve('e.ibex') # @=> e.ibex is'nt eon!
$pleroma->resolve('Ex::Eon::AnimalEon#dog')->role # => dog
autoware ($action, [$key])
Add a key to the pleroma.
File lib/Ex/Eon/AstroEon.pm:
package Ex::Eon::AstroEon;
use common::sense;
use Aion;
has role => (is => 'ro', default => 'upiter');
sub mars { __PACKAGE__->new(role => 'mars') }
sub venus { __PACKAGE__->new(role => 'venus') }
1;
my $pleroma = Aion::Pleroma->new;
$pleroma->autoware('Ex::Eon::AstroEon')->get('Ex::Eon::AstroEon')->role # => upiter
$pleroma->autoware('Ex::Eon::AstroEon#mars', 'ex.mars')->get('ex.mars')->role # => mars
$pleroma->autoware('Ex::Eon::AstroEon#venus')->get('Ex::Eon::AstroEon#venus')->role # => venus
$pleroma->autoware('Ex::Eon::AstroEon')->get('Ex::Eon::AstroEon')->role # => upiter
$pleroma->autoware('Ex::Eon::AstroEon#mars', 'Ex::Eon::AstroEon#venus') # @-> Added eon Ex::Eon::AstroEon#venus twice, with Ex::Eon::AstroEon#mars ne Ex::Eon::AstroEon#venus
AUTHOR
Yaroslav O. Kosmina mailto:dart@cpan.org
LICENSE
⚖ GPLv3
COPYRIGHT
The Aion::Pleroma module is copyright © 2025 Yaroslav O. Kosmina. Rusland. All rights reserved.