|
NAMEVenus::Meta - Class Metadata ABSTRACTClass Metadata for Perl 5 SYNOPSIS package Person;
use Venus::Class;
attr 'fname';
attr 'lname';
package Identity;
use Venus::Role;
attr 'id';
attr 'login';
attr 'password';
sub EXPORT {
# explicitly declare routines to be consumed
['id', 'login', 'password']
}
package Authenticable;
use Venus::Role;
sub authenticate {
return true;
}
sub AUDIT {
my ($self, $from) = @_;
# ensure the caller has a login and password when consumed
die "${from} missing the login attribute" if !$from->can('login');
die "${from} missing the password attribute" if !$from->can('password');
}
sub EXPORT {
# explicitly declare routines to be consumed
['authenticate']
}
package Novice;
use Venus::Mixin;
sub points {
100
}
package User;
use Venus::Class 'attr', 'base', 'mixin', 'test', 'with';
base 'Person';
with 'Identity';
mixin 'Novice';
attr 'email';
test 'Authenticable';
sub valid {
my ($self) = @_;
return $self->login && $self->password ? true : false;
}
package main;
my $user = User->new(
fname => 'Elliot',
lname => 'Alderson',
);
my $meta = $user->meta;
# bless({name => 'User'}, 'Venus::Meta')
DESCRIPTIONThis package provides configuration information for Venus derived classes, roles, and interfaces. METHODSThis package provides the following methods: attrattr(string $name) (boolean) The attr method returns true or false if the package referenced has the attribute accessor named. Since 1.00
attrsattrs() (arrayref) The attrs method returns all of the attributes composed into the package referenced. Since 1.00
basebase(string $name) (boolean) The base method returns true or false if the package referenced has inherited the package named. Since 1.00
basesbases() (arrayref) The bases method returns returns all of the packages inherited by the package referenced. Since 1.00
datadata() (hashref) The data method returns a data structure representing the shallow configuration for the package referenced. Since 1.00
emitemit(string $name, any @args) (any) The emit method invokes the lifecycle hook specified on the underlying package and returns the result. Since 2.91
findfind(string $type, string $name) (tuple[string,tuple[number,arrayref]]) The find method finds and returns the first configuration for the property type specified. This method uses the "search" method to search "roles", "bases", "mixins", and the source package, in the order listed. The "property type" can be any one of "attr", "base", "mixin", or "role". Since 1.02
locallocal(string $type) (arrayref) The local method returns the names of properties defined in the package directly (not inherited) for the property type specified. The $type provided can be either "attrs", "bases", "roles", or "subs". Since 1.02
mixinmixin(string $name) (boolean) The mixin method returns true or false if the package referenced has consumed the mixin named. Since 1.02
mixinsmixins() (arrayref) The mixins method returns all of the mixins composed into the package referenced. Since 1.02
newnew(any %args | hashref $args) (object) The new method returns a new instance of this package. Since 1.00
rolerole(string $name) (boolean) The role method returns true or false if the package referenced has consumed the role named. Since 1.00
rolesroles() (arrayref) The roles method returns all of the roles composed into the package referenced. Since 1.00
searchsearch(string $from, string $type, string $name) (within[arrayref, tuple[string,tuple[number,arrayref]]]) The search method searches the source specified and returns the configurations for the property type specified. The source can be any one of "bases", "roles", "mixins", or "self" for the source package. The "property type" can be any one of "attr", "base", "mixin", or "role". Since 1.02
subsub(string $name) (boolean) The sub method returns true or false if the package referenced has the subroutine named on the package directly, or any of its superclasses. Since 1.00
subssubs() (arrayref) The subs method returns all of the subroutines composed into the package referenced. Since 1.00
AUTHORSAwncorp, "awncorp@cpan.org" LICENSECopyright (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.
|