Footprintless::MixableBase - A base class for using mixins
version 1.26
package Foo; use parent qw(Footprintless::MixableBase) use Footprintless::Mixins qw( _sub_entity ... ); sub _init { my ($self, %options); $self->{debug} = $options{debug}; $self->{user} = $self->_entity('user', 1); return $self; } sub get_user { my ($self) = @_; print("getting user\n") if ($self->{debug}); return $self->{user}; } package main; use Footprintless::Util qw(factory); my $foo = Foo->new( factory({ root => { foo => { user => 'bar' } } }), 'root.foo', debug => 1); my $user = $foo->get_user(); # returns 'bar'
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.
$factory
$coordinate
$self-
_init
Lucas Theisen <lucastheisen@pastdev.com>
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.
Please see those modules/websites for more information related to this module.
Footprintless
Footprintless::Mixins
To install Footprintless, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Footprintless
CPAN shell
perl -MCPAN -e shell install Footprintless
For more information on module installation, please visit the detailed CPAN module installation guide.