| 1 | package Venus::Role::Accessible; | ||
| 2 | |||
| 3 | 61 | ▶ | use 5.018; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 61 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 61 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 61 | ▶ | use Venus::Role 'with'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 61 | with 'Venus::Role::Valuable'; | |
| 11 | 61 | with 'Venus::Role::Buildable'; | |
| 12 | |||
| 13 | # BUILDERS | ||
| 14 | |||
| 15 | sub build_arg { | ||
| 16 | 1201 | ▶ | my ($self, $data) = @_; |
|
Subroutine
build_arg: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 17 | |||
| 18 | return { | ||
| 19 | 1201 | value => $data, | |
| 20 | }; | ||
| 21 | } | ||
| 22 | |||
| 23 | # METHODS | ||
| 24 | |||
| 25 | sub get { | ||
| 26 | 8710 | ▶ | my ($self) = @_; |
|
Subroutine
get: called CC=1 SCAR=0.0
Pod
documented
| |||
| 27 | |||
| 28 | 8710 | return $self->value; | |
| 29 | } | ||
| 30 | |||
| 31 | sub set { | ||
| 32 | 3 | ▶ | my ($self, $value) = @_; |
|
Subroutine
set: called CC=1 SCAR=0.0
Pod
documented
| |||
| 33 | |||
| 34 | 3 | return $self->value($value); | |
| 35 | } | ||
| 36 | |||
| 37 | # EXPORTS | ||
| 38 | |||
| 39 | sub EXPORT { | ||
| 40 | 170 | ▶ | ['BUILDARGS', 'build_arg', 'default', 'get', 'set', 'value'] |
|
Subroutine
EXPORT: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 41 | } | ||
| 42 | |||
| 43 | 61 | 1; | |
| 44 | |||
| 45 | |||
| 46 | |||
| 47 | =head1 NAME | ||
| 48 | |||
| 49 | Venus::Role::Accessible - Accessible Role | ||
| 50 | |||
| 51 | =cut | ||
| 52 | |||
| 53 | =head1 ABSTRACT | ||
| 54 | |||
| 55 | Accessible Role for Perl 5 | ||
| 56 | |||
| 57 | =cut | ||
| 58 | |||
| 59 | =head1 SYNOPSIS | ||
| 60 | |||
| 61 | package Example; | ||
| 62 | |||
| 63 | use Venus::Class; | ||
| 64 | |||
| 65 | with 'Venus::Role::Accessible'; | ||
| 66 | |||
| 67 | package main; | ||
| 68 | |||
| 69 | my $example = Example->new('hello, there'); | ||
| 70 | |||
| 71 | =cut | ||
| 72 | |||
| 73 | =head1 DESCRIPTION | ||
| 74 | |||
| 75 | This package modifies the consuming package and provides a C<value> attribute | ||
| 76 | as well as C<get> and C<set> methods for modifying the value. | ||
| 77 | |||
| 78 | =cut | ||
| 79 | |||
| 80 | =head1 INTEGRATES | ||
| 81 | |||
| 82 | This package integrates behaviors from: | ||
| 83 | |||
| 84 | L<Venus::Role::Buildable> | ||
| 85 | |||
| 86 | L<Venus::Role::Valuable> | ||
| 87 | |||
| 88 | =cut | ||
| 89 | |||
| 90 | =head1 METHODS | ||
| 91 | |||
| 92 | This package provides the following methods: | ||
| 93 | |||
| 94 | =cut | ||
| 95 | |||
| 96 | =head2 get | ||
| 97 | |||
| 98 | get() (Any) | ||
| 99 | |||
| 100 | The get method gets and returns the value. | ||
| 101 | |||
| 102 | I<Since C<0.01>> | ||
| 103 | |||
| 104 | =over 4 | ||
| 105 | |||
| 106 | =item get example 1 | ||
| 107 | |||
| 108 | package main; | ||
| 109 | |||
| 110 | my $example = Example->new(value => 'hey, there'); | ||
| 111 | |||
| 112 | my $get = $example->get; | ||
| 113 | |||
| 114 | # "hey, there" | ||
| 115 | |||
| 116 | =back | ||
| 117 | |||
| 118 | =cut | ||
| 119 | |||
| 120 | =head2 set | ||
| 121 | |||
| 122 | set(Any $value) (Any) | ||
| 123 | |||
| 124 | The set method set the value and returns the value set. | ||
| 125 | |||
| 126 | I<Since C<0.01>> | ||
| 127 | |||
| 128 | =over 4 | ||
| 129 | |||
| 130 | =item set example 1 | ||
| 131 | |||
| 132 | package main; | ||
| 133 | |||
| 134 | my $example = Example->new(value => 'hey, there'); | ||
| 135 | |||
| 136 | my $set = $example->set('hi, there'); | ||
| 137 | |||
| 138 | # "hi, there" | ||
| 139 | |||
| 140 | =back | ||
| 141 | |||
| 142 | =cut | ||