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