NAME
Venus::Core::Mixin - Mixin Base Class
ABSTRACT
Mixin Base Class for Perl 5
SYNOPSIS
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')
DESCRIPTION
This package provides a mixin base class with mixin building and object construction lifecycle hooks.
INHERITS
This package inherits behaviors from:
METHODS
This package provides the following methods:
does
does(string $name) (boolean)
The does method returns true if the object is composed of the role provided.
Since 1.02
- does example 1
-
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
import
import(any @args) (any)
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.
Since 2.91
meta
meta() (Venus::Meta)
The meta method returns a Venus::Meta objects which describes the package's configuration.
Since 1.02
- meta example 1
-
package main; my $user = User->ROLE('Person')->new( fname => 'Elliot', lname => 'Alderson', ); my $meta = Person->meta; # bless({...}, 'Venus::Meta')
unimport
unimport(any @args) (any)
The unimport method invokes the UNIMPORT
lifecycle hook and is invoked whenever the "no" in perlfunc declaration is used.
Since 2.91
AUTHORS
Awncorp, awncorp@cpan.org
LICENSE
Copyright (C) 2022, Awncorp, awncorp@cpan.org
.
This program is free software, you can redistribute it and/or modify it under the terms of the Apache license version 2.0.