| 1 | #!/usr/bin/perl | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | package MooseX::Compile::Base; | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use Path::Class; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 3 | our $VERSION = "0.01"; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 3 | ▶ | use constant DEBUG => our $DEBUG || $ENV{MX_COMPILE_DEBUG}; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.6
Condition33%1/3
our $DEBUG || $ENV{'MX_COMPILE_DEBUG'}
MC/DC0%0/2
our $DEBUG || $ENV{'MX_COMPILE_DEBUG'}
our $DEBUG
$ENV{'MX_COMPILE_DEBUG'}
Truth table33%1/3
A || B
A= our $DEBUGB= $ENV{'MX_COMPILE_DEBUG'}
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 0 | ▶ | sub check_version { | ||||||||||||||||||||||||||
|
Subroutine
check_version: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 15 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 0 | my ( $class, $version, $file ) = @args{qw(class version file)}; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 0 | ▶ | if ( $self->is_version_compatible($version) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | 0 | my ( $basename ) = ( $class =~ /([^:]+)$/ ); | |||||||||||||||||||||||||||
| 21 | 0 | require Carp; | |||||||||||||||||||||||||||
| 22 | 0 | Carp::croak( "class '$class' was compiled by an incompatible version of MooseX::Compile ($version, this is $VERSION). " | |||||||||||||||||||||||||||
| 23 | . "Please remove the files '$basename.pmc' and '$basename.mopc' next to '$file' and recompile the class" ); | ||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 0 | ▶ | sub is_version_compatible { | ||||||||||||||||||||||||||
|
Subroutine
is_version_compatible: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 28 | 0 | my ( $self, $compiled_version, $runtime_version ) = @_; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 0 | ▶ | $runtime_version = $VERSION if not defined $runtime_version; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | $compiled_version gt $runtime_version or ( $compiled_version lt ( $runtime_version - 1 ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 0 | ▶ | sub load_classes { | ||||||||||||||||||||||||||
|
Subroutine
load_classes: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 36 | 0 | my ( $self, @classes ) = @_; | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | foreach my $class ( @classes ) { | |||||||||||||||||||||||||||
| 39 | 0 | ▶ | next if $class->can("meta"); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | 0 | ( my $file = "$class.pm" ) =~ s{::}{/}g; | |||||||||||||||||||||||||||
| 41 | 0 | require $file; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub cached_meta_file { | ||||||||||||||||||||||||||
|
Subroutine
cached_meta_file: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 46 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | my $meta_file = $args{pmc_file} || die "PMC file path must be specified"; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args{'pmc_file'} || die('PMC file path must be specified')
MC/DC0%0/1
$args{'pmc_file'} || die('PMC file path must be specified')
$args{'pmc_file'}
Truth table0%0/2
A
A= $args{'pmc_file'}
| |||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 0 | $meta_file =~ s/\.pmc$/.mopc/; | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | return file($meta_file); | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | { | ||||||||||||||||||||||||||||
| 56 | package MooseX::Compile::Scope::Guard; | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 59 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 60 | 0 | $self->[0]->(); | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | package MooseX::Compile::mangled::immutable_metaclass; | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | package MooseX::Compile::mangled::constraint; | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | package MooseX::Compile::mangled::subref; | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | package MooseX::Compile::MetaBlackHole; | ||||||||||||||||||||||||||||
| 70 | # FIXME use Class::MOP::Immutable's opts? | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub isa { | ||||||||||||||||||||||||||
|
Subroutine
isa: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 73 | 0 | my ( $self, $class ) = @_; | |||||||||||||||||||||||||||
| 74 | 0 | ▶ | return 1 if $class eq 'Moose::Meta::Class' or $class eq 'Class::MOP::Class'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$class eq "Moose::Meta::Class" or $class eq "Class::MOP::Class"
MC/DC0%0/2
$class eq "Moose::Meta::Class" or $class eq "Class::MOP::Class"
$class eq "Moose::Meta::Class"
$class eq "Class::MOP::Class"
Truth table0%0/3
A or B
A= $class eq "Moose::Meta::Class"B= $class eq "Class::MOP::Class"
| |||||||||||||||||||||||||||||
| 75 | 0 | return $self->SUPER::isa($class); | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 0 | ▶ | sub DESTROY {} | ||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 0 | ▶ | sub make_immutable {} | ||||||||||||||||||||||||||
|
Subroutine
make_immutable: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub name { | ||||||||||||||||||||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 83 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 84 | 0 | $self->{name}; | |||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 0 | ▶ | sub superclasses { | ||||||||||||||||||||||||||
|
Subroutine
superclasses: not called CC=2 SCAR=11.6
| |||||||||||||||||||||||||||||
| 88 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 89 | 0 | ▶ | die "Can't set superclasses in class body for compiled classes, use __mx_compile_post_hook" if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 90 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 91 | 0 | @{ $self->name . '::ISA' }; | |||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 0 | ▶ | sub AUTOLOAD { | ||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 95 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 96 | 0 | require Carp; | |||||||||||||||||||||||||||
| 97 | 0 | Carp::carp(sprintf "ignoring meta method %s till pmc finishes loading", our $AUTOLOAD); | |||||||||||||||||||||||||||
| 98 | 0 | return; | |||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 3 | __PACKAGE__ | |||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 3 | __END__ | |||||||||||||||||||||||||||