NAME
Footprintless::MixableBase - A base class for using mixins
VERSION
version 1.29
SYNOPSIS
package
Foo;
_sub_entity
...
)
;
sub
_init {
my
(
$self
,
%options
);
$self
->{debug} =
$options
{debug};
$self
->{user} =
$self
->_entity(
'user'
, 1);
return
$self
;
}
sub
get_user {
my
(
$self
) =
@_
;
(
"getting user\n"
)
if
(
$self
->{debug});
return
$self
->{user};
}
package
main;
my
$foo
= Foo->new(
factory({
root
=> {
foo
=> {
user
=>
'bar'
}
}
}),
'root.foo'
,
debug
=> 1);
my
$user
=
$foo
->get_user();
# returns 'bar'
DESCRIPTION
Provides the boilerplate constructor for packages that want to use Footprintless::Mixins. Specifically, strips off the first two parameters ($factory
and $coordinate
) and sets them as member variables ($self-
{factory}> and $self-
{coordinate}>). Then it passes on the remainder of the arguments to the _init
method. Subclasses should override _init
for additional initialization.
AUTHOR
Lucas Theisen <lucastheisen@pastdev.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Lucas Theisen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
SEE ALSO
Please see those modules/websites for more information related to this module.