| 1 | package MooseX::AutoImmute; | ||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use Hook::AfterRuntime; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 1 | our $VERSION = '0.001'; | |||||||||||
| 7 | |||||||||||||
| 8 | 1 | ▶ | sub import { | ||||||||||
|
Subroutine
import: called CC=3 SCAR=11.1
| |||||||||||||
| 9 | 1 | my $class = shift; | |||||||||||
| 10 | 1 | my ($moose) = @_; | |||||||||||
| 11 | 1 | ▶ | $moose ||= 'Moose'; | ||||||||||
|
Condition50%1/2
$moose ||= "Moose"
MC/DC0%0/1
$moose ||= "Moose"
$moose
Truth table50%1/2
A
A= $moose
| |||||||||||||
| 12 | 1 | my $caller = caller; | |||||||||||
| 13 | 1 | ▶ | eval "package $caller; use $moose; 1" || die $@; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||
| 14 | 1 | ▶ | after_runtime { $caller->meta->make_immutable } | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 15 | 1 | } | |||||||||||
| 16 | |||||||||||||
| 17 | 1 | 1; | |||||||||||
| 18 | |||||||||||||
| 19 | =head1 NAME | ||||||||||||
| 20 | |||||||||||||
| 21 | MooseX::AutoImmute - Use Moose with make_immutable called for you. | ||||||||||||
| 22 | |||||||||||||
| 23 | =head1 DESCRIPTION | ||||||||||||
| 24 | |||||||||||||
| 25 | Moose classes are littered with __PACKAGE__->meta->make_immutable(); at the | ||||||||||||
| 26 | end. This is much like all packages ending with a true value. L<true> removes | ||||||||||||
| 27 | the boilerplate for packages, this removes the boilerplate for L<Moose>. | ||||||||||||
| 28 | |||||||||||||
| 29 | =head1 SYNOPSYS | ||||||||||||
| 30 | |||||||||||||
| 31 | package MyPackage; | ||||||||||||
| 32 | use strict; | ||||||||||||
| 33 | use warnings; | ||||||||||||
| 34 | use MooseX::AutoImmute; | ||||||||||||
| 35 | |||||||||||||
| 36 | has ...; | ||||||||||||
| 37 | |||||||||||||
| 38 | ...; | ||||||||||||
| 39 | |||||||||||||
| 40 | #EOF | ||||||||||||
| 41 | # immutable autamatically! | ||||||||||||
| 42 | |||||||||||||
| 43 | =head1 ALTERNATIVE MOOSE | ||||||||||||
| 44 | |||||||||||||
| 45 | package MyPackage; | ||||||||||||
| 46 | use strict; | ||||||||||||
| 47 | use warnings; | ||||||||||||
| 48 | |||||||||||||
| 49 | # This will import Custom::Moose instead of Moose. | ||||||||||||
| 50 | use MooseX::AutoImmute qw/Custom::Moose/; | ||||||||||||
| 51 | |||||||||||||
| 52 | =head1 AUTHORS | ||||||||||||
| 53 | |||||||||||||
| 54 | Chad Granum L<exodist7@gmail.com> | ||||||||||||
| 55 | |||||||||||||
| 56 | =head1 COPYRIGHT | ||||||||||||
| 57 | |||||||||||||
| 58 | Copyright (C) 2010 Chad Granum | ||||||||||||
| 59 | |||||||||||||
| 60 | MooseX-AutoImmute is free software; Standard perl licence. | ||||||||||||
| 61 | |||||||||||||
| 62 | MooseX-AutoImmute is distributed in the hope that it will be useful, but WITHOUT | ||||||||||||
| 63 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||||||||||||
| 64 | FOR A PARTICULAR PURPOSE. See the license for more details. | ||||||||||||