| 1 | package Mars::Kind::Class; | ||
| 2 | |||
| 3 | 5 | ▶ | use 5.018; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 5 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 5 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 5 | ▶ | use base 'Mars::Kind'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | # METHODS | ||
| 11 | |||
| 12 | sub does { | ||
| 13 | 19 | ▶ | my ($self, @args) = @_; |
|
Subroutine
does: called CC=1 SCAR=0.0
Pod
documented
| |||
| 14 | |||
| 15 | 19 | return $self->DOES(@args); | |
| 16 | } | ||
| 17 | |||
| 18 | sub meta { | ||
| 19 | 16 | ▶ | my ($self) = @_; |
|
Subroutine
meta: called CC=1 SCAR=0.0
Pod
documented
| |||
| 20 | |||
| 21 | 16 | return $self->META; | |
| 22 | } | ||
| 23 | |||
| 24 | sub new { | ||
| 25 | 33 | ▶ | my ($self, @args) = @_; |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||
| 26 | |||
| 27 | 33 | return $self->BLESS(@args); | |
| 28 | } | ||
| 29 | |||
| 30 | 5 | 1; | |
| 31 | |||
| 32 | |||
| 33 | |||
| 34 | =head1 NAME | ||
| 35 | |||
| 36 | Mars::Kind::Class - Class Base Class | ||
| 37 | |||
| 38 | =cut | ||
| 39 | |||
| 40 | =head1 ABSTRACT | ||
| 41 | |||
| 42 | Class Base Class for Perl 5 | ||
| 43 | |||
| 44 | =cut | ||
| 45 | |||
| 46 | =head1 SYNOPSIS | ||
| 47 | |||
| 48 | package User; | ||
| 49 | |||
| 50 | use base 'Mars::Kind::Class'; | ||
| 51 | |||
| 52 | package main; | ||
| 53 | |||
| 54 | my $user = User->new( | ||
| 55 | fname => 'Elliot', | ||
| 56 | lname => 'Alderson', | ||
| 57 | ); | ||
| 58 | |||
| 59 | # bless({fname => 'Elliot', lname => 'Alderson'}, 'User') | ||
| 60 | |||
| 61 | =cut | ||
| 62 | |||
| 63 | =head1 DESCRIPTION | ||
| 64 | |||
| 65 | This package provides a class base class with class building and object | ||
| 66 | construction lifecycle hooks. | ||
| 67 | |||
| 68 | =cut | ||
| 69 | |||
| 70 | =head1 INHERITS | ||
| 71 | |||
| 72 | This package inherits behaviors from: | ||
| 73 | |||
| 74 | L<Mars::Kind> | ||
| 75 | |||
| 76 | =cut | ||
| 77 | |||
| 78 | =head1 METHODS | ||
| 79 | |||
| 80 | This package provides the following methods: | ||
| 81 | |||
| 82 | =cut | ||
| 83 | |||
| 84 | =head2 does | ||
| 85 | |||
| 86 | does(Str $name) (Bool) | ||
| 87 | |||
| 88 | The does method returns true if the object is composed of the role provided. | ||
| 89 | |||
| 90 | I<Since C<0.01>> | ||
| 91 | |||
| 92 | =over 4 | ||
| 93 | |||
| 94 | =item does example 1 | ||
| 95 | |||
| 96 | # given: synopsis | ||
| 97 | |||
| 98 | my $does = $user->does('Identity'); | ||
| 99 | |||
| 100 | # 0 | ||
| 101 | |||
| 102 | =back | ||
| 103 | |||
| 104 | =cut | ||
| 105 | |||
| 106 | =head2 meta | ||
| 107 | |||
| 108 | meta() (Meta) | ||
| 109 | |||
| 110 | The meta method returns a L<Mars::Meta> objects which describes the package's | ||
| 111 | configuration. | ||
| 112 | |||
| 113 | I<Since C<0.01>> | ||
| 114 | |||
| 115 | =over 4 | ||
| 116 | |||
| 117 | =item meta example 1 | ||
| 118 | |||
| 119 | # given: synopsis | ||
| 120 | |||
| 121 | package main; | ||
| 122 | |||
| 123 | my $user = User->new( | ||
| 124 | fname => 'Elliot', | ||
| 125 | lname => 'Alderson', | ||
| 126 | ); | ||
| 127 | |||
| 128 | my $meta = $user->meta; | ||
| 129 | |||
| 130 | # bless({...}, 'Mars::Meta') | ||
| 131 | |||
| 132 | =back | ||
| 133 | |||
| 134 | =cut | ||
| 135 | |||
| 136 | =head2 new | ||
| 137 | |||
| 138 | new(Any %args | HashRef $args) (Object) | ||
| 139 | |||
| 140 | The new method instantiates the class and returns a new object. | ||
| 141 | |||
| 142 | I<Since C<0.01>> | ||
| 143 | |||
| 144 | =over 4 | ||
| 145 | |||
| 146 | =item new example 1 | ||
| 147 | |||
| 148 | package main; | ||
| 149 | |||
| 150 | my $user = User->new( | ||
| 151 | fname => 'Elliot', | ||
| 152 | lname => 'Alderson', | ||
| 153 | ); | ||
| 154 | |||
| 155 | # bless({fname => 'Elliot', lname => 'Alderson'}, 'User') | ||
| 156 | |||
| 157 | =back | ||
| 158 | |||
| 159 | =over 4 | ||
| 160 | |||
| 161 | =item new example 2 | ||
| 162 | |||
| 163 | package main; | ||
| 164 | |||
| 165 | my $user = User->new({ | ||
| 166 | fname => 'Elliot', | ||
| 167 | lname => 'Alderson', | ||
| 168 | }); | ||
| 169 | |||
| 170 | # bless({fname => 'Elliot', lname => 'Alderson'}, 'User') | ||
| 171 | |||
| 172 | =back | ||
| 173 | |||
| 174 | =cut | ||
| 175 | |||
| 176 | =head1 AUTHORS | ||
| 177 | |||
| 178 | Awncorp, C<awncorp@cpan.org> | ||
| 179 | |||
| 180 | =cut | ||