Venus::Core::Role - Role Base Class
Role Base Class for Perl 5
package Person; use base 'Venus::Core::Role'; package User; use base 'Venus::Core::Class'; package main; my $user = User->ROLE('Person')->new( fname => 'Elliot', lname => 'Alderson', ); # bless({fname => 'Elliot', lname => 'Alderson'}, 'User')
This package provides a role base class with role building and object construction lifecycle hooks.
This package inherits behaviors from:
Venus::Core
This package provides the following methods:
does(string $name) (boolean)
The does method returns true if the object is composed of the role provided.
Since 1.00
1.00
package Employee; use base 'Venus::Core::Role'; Employee->ROLE('Person'); package main; my $user = User->ROLE('Employee')->new( fname => 'Elliot', lname => 'Alderson', ); my $does = Employee->does('Person'); # 1
import(any @args) (any)
The import method throws a fatal exception whenever the "use" in perlfunc declaration is used with roles as they are meant to be consumed via the with or role keyword functions.
with
role
Since 2.91
2.91
package main; use Person; # Exception! (isa Venus::Fault)
meta() (Venus::Meta)
The meta method returns a Venus::Meta objects which describes the package's configuration.
package main; my $user = User->ROLE('Person')->new( fname => 'Elliot', lname => 'Alderson', ); my $meta = Person->meta; # bless({...}, 'Venus::Meta')
unimport(any @args) (any)
The unimport method invokes the UNIMPORT lifecycle hook and is invoked whenever the "no" in perlfunc declaration is used.
UNIMPORT
package main; no User; # ()
Awncorp, awncorp@cpan.org
awncorp@cpan.org
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.
To install Venus, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Venus
CPAN shell
perl -MCPAN -e shell install Venus
For more information on module installation, please visit the detailed CPAN module installation guide.