Venus::Core::Mixin
Mixin Base Class
Mixin Base Class for Perl 5
method: import method: does method: meta method: unimport
package Person;
use base 'Venus::Core::Mixin';
package User;
use base 'Venus::Core::Class';
package main;
my $user = User->MIXIN('Person')->new(
fname => 'Elliot',
lname => 'Alderson',
);
# bless({fname => 'Elliot', lname => 'Alderson'}, 'User')
This package provides a mixin base class with mixin building and object construction lifecycle hooks.
Venus::Core
The import method throws a fatal exception whenever the "use" in perlfunc declaration is used with mixins as they are meant to be consumed via the mixin keyword function.
import(any @args) (any)
{ since => '2.91', }
=example-1 import
package main;
use Person;
# Exception! (isa Venus::Fault)
The does method returns true if the object is composed of the role provided.
does(string $name) (boolean)
{ since => '1.02', }
=example-1 does
package Employee;
use base 'Venus::Core::Role';
Employee->MIXIN('Person');
package main;
my $user = User->ROLE('Employee')->new(
fname => 'Elliot',
lname => 'Alderson',
);
my $does = $user->does('Employee');
# 1
The meta method returns a Venus::Meta objects which describes the package's configuration.
meta() (Venus::Meta)
{ since => '1.02', }
=example-1 meta
package main;
my $user = User->ROLE('Person')->new(
fname => 'Elliot',
lname => 'Alderson',
);
my $meta = Person->meta;
# bless({...}, 'Venus::Meta')
The unimport method invokes the UNIMPORT lifecycle hook and is invoked whenever the "no" in perlfunc declaration is used.
unimport(any @args) (any)
{ since => '2.91', }
t/Venus.t: present: authors t/Venus.t: present: license
21 POD Errors
The following errors were encountered while parsing the POD:
- Around line 14:
Unknown directive: =name
- Around line 22:
Unknown directive: =tagline
- Around line 30:
Unknown directive: =abstract
- Around line 38:
Unknown directive: =includes
- Around line 49:
Unknown directive: =synopsis
- Around line 82:
Unknown directive: =description
- Around line 91:
Unknown directive: =inherits
- Around line 99:
Unknown directive: =method
- Around line 105:
Unknown directive: =signature
- Around line 109:
Unknown directive: =metadata
- Around line 129:
Unknown directive: =method
- Around line 133:
Unknown directive: =signature
- Around line 137:
Unknown directive: =metadata
- Around line 172:
Unknown directive: =method
- Around line 177:
Unknown directive: =signature
- Around line 181:
Unknown directive: =metadata
- Around line 210:
Unknown directive: =method
- Around line 215:
Unknown directive: =signature
- Around line 219:
Unknown directive: =metadata
- Around line 235:
=cut found outside a pod block. Skipping to next block.
- Around line 241:
Unknown directive: =partials