Venus::Role::Accessible - Accessible Role
Accessible Role for Perl 5
package Example; use Venus::Class; with 'Venus::Role::Accessible'; attr 'value'; sub downcase { lc $_[0]->value } sub upcase { uc $_[0]->value } package main; my $example = Example->new(value => 'hello, there'); # $example->value;
This package modifies the consuming package and provides the access method for getting and setting attributes.
access
This package provides the following methods:
access(string $name, any $value) (any)
The access method gets or sets the class attribute specified.
Since 1.23
1.23
# given: synopsis package main; my $access = $example->access; # undef
# given: synopsis package main; my $access = $example->access('value'); # "hello, there"
# given: synopsis package main; my $access = $example->access('value', 'something'); # "something"
# given: synopsis package main; my $instance = $example; # bless({}, "Example") $example->access('value', 'something'); # "something" $instance = $example; # bless({value => "something"}, "Example")
assign(string $name, string | coderef $code, any @args) (any)
The assign method dispatches the method call or executes the callback, sets the class attribute specified to the result, and returns the result.
# given: synopsis package main; my $assign = $example->assign('value', 'downcase'); # "hello, there"
# given: synopsis package main; my $assign = $example->assign('value', 'upcase'); # "HELLO, THERE"
# given: synopsis package main; my $instance = $example; # bless({value => "hello, there"}, "Example") my $assign = $example->assign('value', 'downcase'); # "hello, there" $instance = $example; # bless({value => "hello, there"}, "Example")
Awncorp, awncorp@cpan.org
awncorp@cpan.org
Copyright (C) 2000, 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.