| 1 | package MOP::Class; | ||||||||||
| 2 | # ABSTRACT: A representation of a class | ||||||||||
| 3 | |||||||||||
| 4 | 11 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 11 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 11 | ▶ | use mro (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 11 | ▶ | use Carp (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 11 | ▶ | use UNIVERSAL::Object::Immutable; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 11 | ▶ | use MOP::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 11 | ▶ | use MOP::Method; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 11 | ▶ | use MOP::Slot; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 11 | ▶ | use MOP::Internal::Util; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | |||||||||||
| 18 | 11 | our $VERSION = '0.11'; | |||||||||
| 19 | 11 | our $AUTHORITY = 'cpan:STEVAN'; | |||||||||
| 20 | |||||||||||
| 21 | 11 | ▶ | our @ISA; BEGIN { @ISA = 'UNIVERSAL::Object::Immutable' }; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 11 | ▶ | our @DOES; BEGIN { @DOES = 'MOP::Role' }; # to be composed later ... | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | |||||||||||
| 24 | UNITCHECK { | ||||||||||
| 25 | # apply them roles ... | ||||||||||
| 26 | MOP::Internal::Util::APPLY_ROLES( | ||||||||||
| 27 | MOP::Role->new( name => __PACKAGE__ ), | ||||||||||
| 28 | \@DOES, | ||||||||||
| 29 | to => 'class' | ||||||||||
| 30 | ); | ||||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | # superclasses | ||||||||||
| 34 | |||||||||||
| 35 | sub superclasses { | ||||||||||
| 36 | 14 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
superclasses: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 37 | 14 | my $isa = MOP::Internal::Util::GET_GLOB_SLOT( $self->stash, 'ISA', 'ARRAY' ); | |||||||||
| 38 | 14 | ▶ | return unless $isa; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 8 | return @$isa; | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | sub set_superclasses { | ||||||||||
| 43 | 1 | ▶ | my ($self, @superclasses) = @_; | ||||||||
|
Subroutine
set_superclasses: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 44 | 1 | ▶ | Carp::croak('[ARGS] You must specify at least one superclass') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | if scalar( @superclasses ) == 0; | ||||||||||
| 46 | 1 | MOP::Internal::Util::SET_GLOB_SLOT( $self->stash, 'ISA', \@superclasses ); | |||||||||
| 47 | 1 | return; | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | sub mro { | ||||||||||
| 51 | 13 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
mro: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 52 | 13 | return mro::get_linear_isa( $self->name ); | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 11 | 1; | |||||||||
| 56 | |||||||||||
| 57 | __END__ | ||||||||||