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 13:
Unknown directive: =name
- Around line 21:
Unknown directive: =tagline
- Around line 29:
Unknown directive: =abstract
- Around line 37:
Unknown directive: =includes
- Around line 48:
Unknown directive: =synopsis
- Around line 81:
Unknown directive: =description
- Around line 90:
Unknown directive: =inherits
- Around line 98:
Unknown directive: =method
- Around line 104:
Unknown directive: =signature
- Around line 108:
Unknown directive: =metadata
- Around line 128:
Unknown directive: =method
- Around line 132:
Unknown directive: =signature
- Around line 136:
Unknown directive: =metadata
- Around line 171:
Unknown directive: =method
- Around line 176:
Unknown directive: =signature
- Around line 180:
Unknown directive: =metadata
- Around line 209:
Unknown directive: =method
- Around line 214:
Unknown directive: =signature
- Around line 218:
Unknown directive: =metadata
- Around line 234:
=cut found outside a pod block. Skipping to next block.
- Around line 240:
Unknown directive: =partials