| 1 | package Reaction::Class; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 9 | ▶ | use Moose qw(confess); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 9 | ▶ | use Sub::Exporter (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 9 | ▶ | use Sub::Name (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 9 | ▶ | use Reaction::Types::Core ':all'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 9 | ▶ | use Reaction::Object; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 516 | ▶ | sub exporter_for_package { | ||||||||||||||||||||||||||
|
Subroutine
exporter_for_package: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 10 | 516 | my ($self, $package) = @_; | |||||||||||||||||||||||||||
| 11 | 516 | my %exports_proto = $self->exports_for_package($package); | |||||||||||||||||||||||||||
| 12 | 9 | ▶ | no warnings 'uninitialized'; # XXX fix this | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | my %exports = ( | ||||||||||||||||||||||||||||
| 14 | 516 | ▶ | map { my $cr = $exports_proto{$_}; ($_, sub { Sub::Name::subname "${self}::$_" => $cr; }) } | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | keys %exports_proto | ||||||||||||||||||||||||||||
| 16 | ); | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 516 | my $exporter = Sub::Exporter::build_exporter({ | |||||||||||||||||||||||||||
| 19 | exports => \%exports, | ||||||||||||||||||||||||||||
| 20 | groups => { | ||||||||||||||||||||||||||||
| 21 | default => [':all'] | ||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||
| 23 | }); | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 516 | return $exporter; | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 524 | ▶ | sub do_import { | ||||||||||||||||||||||||||
|
Subroutine
do_import: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 29 | 524 | my ($self, $pkg, $args) = @_; | |||||||||||||||||||||||||||
| 30 | 524 | my $exporter = $self->exporter_for_package($pkg, $args); | |||||||||||||||||||||||||||
| 31 | 524 | $exporter->($self, { into => $pkg }, @$args); | |||||||||||||||||||||||||||
| 32 | 524 | ▶ | if (my @default_base = $self->default_base) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | 9 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 34 | 447 | ▶ | @{"${pkg}::ISA"} = @default_base unless @{"${pkg}::ISA"}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 377 | ▶ | sub default_base { ('Reaction::Object'); } | ||||||||||||||||||||||||||
|
Subroutine
default_base: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 520 | ▶ | sub exports_for_package { | ||||||||||||||||||||||||||
|
Subroutine
exports_for_package: called CC=1 SCAR=1.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 41 | 520 | my ($self, $package) = @_; | |||||||||||||||||||||||||||
| 42 | return ( | ||||||||||||||||||||||||||||
| 43 | 5 | ▶ | set_or_lazy_build => sub { | ||||||||||||||||||||||||||
|
Subroutine
: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||
| 44 | 5 | my $name = shift; | |||||||||||||||||||||||||||
| 45 | 5 | my $build = "build_${name}"; | |||||||||||||||||||||||||||
| 46 | return (required => 1, lazy => 1, | ||||||||||||||||||||||||||||
| 47 | 0 | ▶ | default => sub { shift->$build(); }); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 48 | }, | ||||||||||||||||||||||||||||
| 49 | 1 | ▶ | set_or_lazy_fail => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 50 | 1 | my $name = shift; | |||||||||||||||||||||||||||
| 51 | 1 | my $message = "${name} must be provided before calling reader"; | |||||||||||||||||||||||||||
| 52 | return (required => 1, lazy => 1, | ||||||||||||||||||||||||||||
| 53 | 0 | ▶ | default => sub { confess($message); }); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.4
| |||||||||||||||||||||||||||||
| 54 | }, | ||||||||||||||||||||||||||||
| 55 | 12 | ▶ | trigger_adopt => sub { | ||||||||||||||||||||||||||
|
Subroutine
: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 56 | 12 | my $type = shift; | |||||||||||||||||||||||||||
| 57 | 12 | my @args = @_; | |||||||||||||||||||||||||||
| 58 | 12 | my $adopt = "adopt_${type}"; | |||||||||||||||||||||||||||
| 59 | 0 | ▶ | return (trigger => sub { shift->$adopt(@args); }); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 60 | }, | ||||||||||||||||||||||||||||
| 61 | 0 | ▶ | register_inc_entry => sub { | ||||||||||||||||||||||||||
|
Subroutine
: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 62 | 0 | my $inc = $package; | |||||||||||||||||||||||||||
| 63 | 0 | $inc =~ s/::/\//g; | |||||||||||||||||||||||||||
| 64 | 0 | $inc .= '.pm'; | |||||||||||||||||||||||||||
| 65 | 0 | $INC{$inc} = 1; | |||||||||||||||||||||||||||
| 66 | }, | ||||||||||||||||||||||||||||
| 67 | #this needs to go away soon. its never used. pollution. | ||||||||||||||||||||||||||||
| 68 | 0 | ▶ | reflect_attributes_from => sub { | ||||||||||||||||||||||||||
|
Subroutine
: not called CC=3 SCAR=22.6
| |||||||||||||||||||||||||||||
| 69 | 0 | my ($from_class, @attrs) = @_; | |||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | #Should we use Class::Inspector to make sure class is loaded? | ||||||||||||||||||||||||||||
| 72 | #unless( Class::Inspector->loaded($from_class) ){ | ||||||||||||||||||||||||||||
| 73 | # eval "require $from_class" || die("Failed to load: $from_class"); | ||||||||||||||||||||||||||||
| 74 | #} | ||||||||||||||||||||||||||||
| 75 | 0 | foreach my $attr_name (@attrs){ | |||||||||||||||||||||||||||
| 76 | 0 | my $from_attr = $from_class->meta->get_attribute($attr_name); | |||||||||||||||||||||||||||
| 77 | 0 | ▶ | confess("$from_attr does not exist in $from_class") | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 78 | unless $from_attr; | ||||||||||||||||||||||||||||
| 79 | #Not happy | ||||||||||||||||||||||||||||
| 80 | #$package->meta->add_attribute( $from_attr->name, %{$from_attr} ); | ||||||||||||||||||||||||||||
| 81 | 0 | $package->meta->add_attribute( bless { %{$from_attr} } => | |||||||||||||||||||||||||||
| 82 | $package->meta->attribute_metaclass ); | ||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | }, | ||||||||||||||||||||||||||||
| 85 | 4 | ▶ | class => sub { | ||||||||||||||||||||||||||
|
Subroutine
: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 86 | 4 | $self->do_class_sub($package, @_); | |||||||||||||||||||||||||||
| 87 | }, | ||||||||||||||||||||||||||||
| 88 | 0 | ▶ | does => sub { | ||||||||||||||||||||||||||
|
Subroutine
: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 89 | 0 | $package->can('with')->(@_); | |||||||||||||||||||||||||||
| 90 | }, | ||||||||||||||||||||||||||||
| 91 | 0 | ▶ | overrides => sub { | ||||||||||||||||||||||||||
|
Subroutine
: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 92 | 0 | $package->can('override')->(@_) | |||||||||||||||||||||||||||
| 93 | }, | ||||||||||||||||||||||||||||
| 94 | $self->make_package_sub($package), | ||||||||||||||||||||||||||||
| 95 | 0 | ▶ | implements => sub { confess "implements only valid within class block" }, | ||||||||||||||||||||||||||
|
Subroutine
: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 96 | $self->make_sugar_sub('is'), | ||||||||||||||||||||||||||||
| 97 | $self->make_code_sugar_sub('which'), | ||||||||||||||||||||||||||||
| 98 | $self->make_code_sugar_sub('as'), | ||||||||||||||||||||||||||||
| 99 | 0 | ▶ | run => sub (;&@) { @_ }, | ||||||||||||||||||||||||||
|
Subroutine
: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 100 | 520 | ); | |||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 4 | ▶ | sub do_class_sub { | ||||||||||||||||||||||||||
|
Subroutine
do_class_sub: called CC=10 SCAR=26.6
Pod
undocumented
| |||||||||||||||||||||||||||||
| 104 | 4 | my ($self, $package, $class, @args) = @_; | |||||||||||||||||||||||||||
| 105 | 4 | my $error = "Invalid class declaration, should be: class Class (is Superclass)*, which { ... }"; | |||||||||||||||||||||||||||
| 106 | 4 | ▶ | confess $error if (@args % 1); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 107 | 4 | my @supers; | |||||||||||||||||||||||||||
| 108 | 4 | ▶ | while (@args > 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 109 | 4 | my $should_be_is = shift(@args); | |||||||||||||||||||||||||||
| 110 | 4 | ▶ | confess $error unless $should_be_is eq 'is'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 111 | 4 | push(@supers, shift(@args)); | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | 4 | ▶ | confess $error unless $args[0] eq 'which' && ref($args[1]) eq 'CODE'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$args[0] eq "which" and ref $args[1] eq "CODE"
MC/DC0%0/2
$args[0] eq "which" and ref $args[1] eq "CODE"
$args[0] eq "which"
ref $args[1] eq "CODE"
Truth table33%1/3
A and B
A= $args[0] eq "which"B= ref $args[1] eq "CODE"
| |||||||||||||||||||||||||||||
| 114 | 4 | my $setup = $args[1]; | |||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | #this eval is fucked, but I can't fix it | ||||||||||||||||||||||||||||
| 117 | 4 | ▶ | unless ($class->can('meta')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 118 | 0 | print STDERR "** MAKING CLASS $class useing Reaction::Class **\n"; | |||||||||||||||||||||||||||
| 119 | 0 | eval "package ${class}; use Reaction::Class;"; | |||||||||||||||||||||||||||
| 120 | 0 | ▶ | if ($@) { confess "Couldn't make ${class} a Reaction class: $@"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | 4 | ▶ | if (@supers) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 123 | 4 | Class::MOP::load_class($_) for @supers; | |||||||||||||||||||||||||||
| 124 | 4 | $class->meta->superclasses(@supers); | |||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||
| 126 | 4 | $self->setup_and_cleanup($package, $setup); | |||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | #immutable code | ||||||||||||||||||||||||||||
| 129 | #print STDERR "$package \n"; | ||||||||||||||||||||||||||||
| 130 | #print STDERR $package->meta->blessed, " \n"; | ||||||||||||||||||||||||||||
| 131 | 4 | $package->meta->make_immutable; | |||||||||||||||||||||||||||
| 132 | # (inline_accessor => 0, inline_destructor => 0,inline_constructor => 0,); | ||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | 4 | ▶ | sub setup_and_cleanup { | ||||||||||||||||||||||||||
|
Subroutine
setup_and_cleanup: called CC=6 SCAR=18.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 136 | 4 | my ($self, $package, $setup) = @_; | |||||||||||||||||||||||||||
| 137 | 4 | my @methods; | |||||||||||||||||||||||||||
| 138 | my @apply_after; | ||||||||||||||||||||||||||||
| 139 | 4 | my %save_delayed; | |||||||||||||||||||||||||||
| 140 | { | ||||||||||||||||||||||||||||
| 141 | 9 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 142 | 9 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 143 | 4 | local *{"${package}::implements"} = | |||||||||||||||||||||||||||
| 144 | 0 | ▶ | Sub::Name::subname "${self}::implements" => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 145 | 0 | my $name = shift; | |||||||||||||||||||||||||||
| 146 | 0 | ▶ | shift if $_[0] eq 'as'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 147 | 0 | push(@methods, [ $name, shift ]); | |||||||||||||||||||||||||||
| 148 | 4 | }; | |||||||||||||||||||||||||||
| 149 | 4 | my $s = $setup; | |||||||||||||||||||||||||||
| 150 | 4 | foreach my $meth ($self->delayed_methods) { | |||||||||||||||||||||||||||
| 151 | 32 | $save_delayed{$meth} = $package->can($meth); | |||||||||||||||||||||||||||
| 152 | 32 | my $s_copy = $s; | |||||||||||||||||||||||||||
| 153 | 32 | ▶ | $s = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||
| 154 | 32 | local *{"${package}::${meth}"} = | |||||||||||||||||||||||||||
| 155 | 0 | ▶ | Sub::Name::subname "${self}::${meth}" => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 156 | 0 | push(@apply_after, [ $meth => @_ ]); | |||||||||||||||||||||||||||
| 157 | 32 | }; | |||||||||||||||||||||||||||
| 158 | 32 | $s_copy->(@_); | |||||||||||||||||||||||||||
| 159 | 32 | }; | |||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||
| 161 | # XXX - need additional fuckery to handle multi-class-per-file | ||||||||||||||||||||||||||||
| 162 | 4 | $s->(); # populate up the crap | |||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | 4 | my %exports = $self->exports_for_package($package); | |||||||||||||||||||||||||||
| 165 | { | ||||||||||||||||||||||||||||
| 166 | 9 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 167 | 4 | foreach my $nuke (keys %exports) { | |||||||||||||||||||||||||||
| 168 | 56 | delete ${"${package}::"}{$nuke}; | |||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||
| 171 | 4 | my $unimport_class = $self->next_import_package; | |||||||||||||||||||||||||||
| 172 | 4 | ▶ | eval "package ${package}; no $unimport_class;"; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 173 | 4 | ▶ | confess "$unimport_class unimport from ${package} failed: $@" if $@; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 174 | 4 | foreach my $m (@methods) { | |||||||||||||||||||||||||||
| 175 | 0 | $self->add_method_to_target($package, $m); | |||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||
| 177 | 4 | foreach my $a (@apply_after) { | |||||||||||||||||||||||||||
| 178 | 0 | my $call = shift(@$a); | |||||||||||||||||||||||||||
| 179 | 0 | $save_delayed{$call}->(@$a); | |||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | 0 | ▶ | sub add_method_to_target { | ||||||||||||||||||||||||||
|
Subroutine
add_method_to_target: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 184 | 0 | my ($self, $target, $method) = @_; | |||||||||||||||||||||||||||
| 185 | 0 | $target->meta->add_method(@$method); | |||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | 4 | ▶ | sub delayed_methods { | ||||||||||||||||||||||||||
|
Subroutine
delayed_methods: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 189 | 4 | return (qw/has with extends before after around override augment/); | |||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 520 | ▶ | sub make_package_sub { | ||||||||||||||||||||||||||
|
Subroutine
make_package_sub: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 193 | 520 | my ($self, $package) = @_; | |||||||||||||||||||||||||||
| 194 | 520 | my ($last) = (split('::', $package))[-1]; | |||||||||||||||||||||||||||
| 195 | 159 | ▶ | return $last => sub { | ||||||||||||||||||||||||||
|
Subroutine
: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 196 | 159 | $self->do_package_sub($package => @_); | |||||||||||||||||||||||||||
| 197 | 520 | }; | |||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | 159 | ▶ | sub do_package_sub { | ||||||||||||||||||||||||||
|
Subroutine
do_package_sub: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 201 | 159 | my $self = shift; | |||||||||||||||||||||||||||
| 202 | 159 | my $package = shift; | |||||||||||||||||||||||||||
| 203 | 159 | ▶ | return (@_ ? ($package => @_) : $package); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | 520 | ▶ | sub make_sugar_sub { | ||||||||||||||||||||||||||
|
Subroutine
make_sugar_sub: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 207 | 520 | my ($self, $name) = @_; | |||||||||||||||||||||||||||
| 208 | 4 | ▶ | return $name => sub { | ||||||||||||||||||||||||||
|
Subroutine
: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 209 | 4 | return ($name => @_); | |||||||||||||||||||||||||||
| 210 | 520 | }; | |||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 1040 | ▶ | sub make_code_sugar_sub { | ||||||||||||||||||||||||||
|
Subroutine
make_code_sugar_sub: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 214 | 1040 | my ($self, $name) = @_; | |||||||||||||||||||||||||||
| 215 | 4 | ▶ | return $name => sub (;&@) { | ||||||||||||||||||||||||||
|
Subroutine
: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 216 | 4 | return ($name => @_); | |||||||||||||||||||||||||||
| 217 | 1040 | }; | |||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 524 | ▶ | sub import { | ||||||||||||||||||||||||||
|
Subroutine
import: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 221 | 524 | my $self = shift; | |||||||||||||||||||||||||||
| 222 | 524 | my $pkg = caller; | |||||||||||||||||||||||||||
| 223 | 524 | my @args = @_; | |||||||||||||||||||||||||||
| 224 | 524 | strict->import; | |||||||||||||||||||||||||||
| 225 | 524 | warnings->import; | |||||||||||||||||||||||||||
| 226 | 524 | $self->do_import($pkg, \@args); | |||||||||||||||||||||||||||
| 227 | 524 | ▶ | goto &{$self->next_import} if $self->next_import; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | 1032 | ▶ | sub next_import { | ||||||||||||||||||||||||||
|
Subroutine
next_import: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 231 | 1032 | return shift->next_import_package(@_)->can('import'); | |||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | 898 | ▶ | sub next_import_package { 'Moose' } | ||||||||||||||||||||||||||
|
Subroutine
next_import_package: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | 9 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 9 | 1; | |||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | #---------#---------#---------#---------#---------#---------#---------#--------# | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | =head1 NAME | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | Reaction::Class | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | =over | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | =item * L<Catalyst> | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | =item * L<Reaction::Manual> | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | =back | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | =head1 Unstructured reminders | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | (will properly format and stuff later. no time right now) | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | C<use>ing C<Reaction::Class> will alias the current package name | ||||||||||||||||||||||||||||
| 263 | see L<aliased>. | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | package MyApp::Pretty::Picture | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | # Picture expands to 'MyApp::Pretty::Picture' | ||||||||||||||||||||||||||||
| 268 | class Picture, which { ... | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | =head2 default_base | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | =head2 set_or_lazy_build $attrname | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | Will make your attributes lazy and required, if they are not set they | ||||||||||||||||||||||||||||
| 275 | will default to the value returned by C<&build_$attrname> | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | has created_d => (isa => 'DateTime', set_or_lazy_build('created_d') ); | ||||||||||||||||||||||||||||
| 278 | sub build_created_d{ DateTime->now } | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | =head2 set_or_lazy_fail $attrname | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | Will make your attributes lazy and required, if they are not set | ||||||||||||||||||||||||||||
| 283 | and their accessor is called an exception will be thrown | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | =head2 trigger_adopt $attrname | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | =head2 register_inc_entry | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | =head2 reflect_attributes_from $from_class, @attrs | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | Create attributes in the local class that mirror the specified C<@attrs> | ||||||||||||||||||||||||||||
| 292 | in C<$from_class> | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | =head2 class $name [, is $superclass ], which { | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | Sugary class declaration, will create a a package C<$name> with an | ||||||||||||||||||||||||||||
| 297 | optional base class of $superclass. The class declaration, should be placed inside | ||||||||||||||||||||||||||||
| 298 | the brackets using C<implements> to declare a method and C<has> to declare an | ||||||||||||||||||||||||||||
| 299 | attribute. | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | =head2 does | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | Alias to C<with> for the current package, see C<Moose::Role> | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | =head2 implements $method_name [is | which | as] | ||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | Only valid whithin a class block, allows you to declare a method for the class. | ||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | implements 'current_date' => as { DateTime->today }; | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | =head2 run | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | =head1 AUTHORS | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | =over | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | =item * Matt S. Trout | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | =item * K. J. Cheetham | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | =item * Guillermo Roditi | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | =item * Justin Hunter | ||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | =item * Jess Robinson (Documentation) | ||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||
| 327 | =item * Kaare Rasmussen (Documentation) | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | =item * Andres N. Kievsky (Documentation) | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | =item * Robert Sedlacek (Documentation) | ||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | =back | ||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | =head1 SPONSORS | ||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | =over | ||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | =item * Ionzero | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | L<Ionzero|http://www.ionzero.com/> sponsored the writing of the | ||||||||||||||||||||||||||||
| 342 | L<Reaction::Manual::Tutorial>, L<Reaction::Manual::Overview> and | ||||||||||||||||||||||||||||
| 343 | L<Reaction::Manual::Widgets> documentations as well as improvements | ||||||||||||||||||||||||||||
| 344 | to L<Reaction::Manual::Intro> and many API documentation improvements | ||||||||||||||||||||||||||||
| 345 | throughout the project. | ||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||
| 347 | =back | ||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | =head1 LICENSE | ||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||
| 351 | This library is free software, you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 352 | it under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||
| 354 | =cut | ||||||||||||||||||||||||||||