| 1 | package Application::Pipeline; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 3 | $VERSION = '0.1'; | |||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | =head1 Application::Pipeline | ||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | Application::Pipeline is a module designed to map methods ( referred to in this | ||||||||||||||||||||||||||||||||||||||||||||||
| 7 | role as handlers ) to different phases of an application's life cycle. | ||||||||||||||||||||||||||||||||||||||||||||||
| 8 | By assigning methods to different phases of this pipeline, the author can | ||||||||||||||||||||||||||||||||||||||||||||||
| 9 | concentrate on the logic for each phase and let the framework manage the | ||||||||||||||||||||||||||||||||||||||||||||||
| 10 | application flow. Adopting the same idea as CGI::Application, writing an | ||||||||||||||||||||||||||||||||||||||||||||||
| 11 | application with Application::Pipeline is a matter of creating a module that is | ||||||||||||||||||||||||||||||||||||||||||||||
| 12 | a subclass of Application::Pipeline. | ||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | =head2 The %plan | ||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | To build a pipeline application, it is necessary to register methods to run | ||||||||||||||||||||||||||||||||||||||||||||||
| 17 | during each phase. This can be done one at a time, with the C<addHandler> | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | method. But Application::Pipeline also looks in the subclass package for the | ||||||||||||||||||||||||||||||||||||||||||||||
| 19 | package variable C<%plan>. This hash's keys are the names of the phases of the | ||||||||||||||||||||||||||||||||||||||||||||||
| 20 | pipeline. Each key points to an array reference which is a list of the methods | ||||||||||||||||||||||||||||||||||||||||||||||
| 21 | to run for that phase. The methods are either the names of the methods to run, | ||||||||||||||||||||||||||||||||||||||||||||||
| 22 | or references to the actual methods. | ||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||
| 24 | This is not the be-all end-all definition of the pipeline. It is still possible | ||||||||||||||||||||||||||||||||||||||||||||||
| 25 | to use C<addHandler> to modify the pipeline, and as explained later, it is | ||||||||||||||||||||||||||||||||||||||||||||||
| 26 | possible to take into account C<%plan>s defined in superclasses. | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||
| 28 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | #-- pragmas ---------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||
| 34 | #-- modules ---------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 3 | ▶ | use Symbol qw( gensym ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||
| 37 | #-- package variables ------------------ | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 3 | our @phase_stages = qw( FIRST EARLY MIDDLE LATE LAST ); | |||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||
| 41 | #=============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | =head2 Running an Application::Pipeline Application | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||
| 45 | Application::Pipeline is an object oriented module, but has no constructor. It | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | is intended to be used as a base class only. The primary responsibility of | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | a constructor under Application::Pipeline is to specify an ordered list of | ||||||||||||||||||||||||||||||||||||||||||||||
| 48 | names for the phases of the pipeline. As it would be impractical to come up | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | with one unified set of phases that suited every kind of application that | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | Application::Pipeline could drive, that task, and the constructor along with it, | ||||||||||||||||||||||||||||||||||||||||||||||
| 51 | is left to subclasses. | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||
| 53 | It is expected that there may eventually become a set of first-level subclasses | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | that define common sets of phases for different problem spaces. This way | ||||||||||||||||||||||||||||||||||||||||||||||
| 55 | plugins that are suited to those domains may expect to find a predictable set of | ||||||||||||||||||||||||||||||||||||||||||||||
| 56 | phases when included. For an initial example of one such subclass, see | ||||||||||||||||||||||||||||||||||||||||||||||
| 57 | WWW::Pipeline. | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||
| 59 | =head3 run | ||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||
| 61 | $pipeline->run() | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||
| 63 | A script calls this method when it is ready to run the application. There are | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | no parameters | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||
| 66 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | sub run { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | $self->_buildPlan(); | |||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | foreach my $phase ( @{$self->{_phases}} ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | foreach my $stage ( @phase_stages ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||
| 76 | next unless defined $self->{_plan}{$phase}{$stage} | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | and scalar @{$self->{_plan}{$phase}{$stage}}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
defined $self->{"_plan"}{$phase}{$stage} and scalar @{$self->{"_plan"}{$phase}{$stage};}
MC/DC0%0/1
defined $self->{"_plan"}{$phase}{$stage} and scalar @{$self->{"_plan"}{$phase}{$stage};}
defined $self->{"_plan"}{$phase}{$stage}
Truth table0%0/2
A
A= defined $self->{"_plan"}{$phase}{$stage}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | foreach my $method ( @{$self->{_plan}{$phase}{$stage}} ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | if( $self->can($method) ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | $self->$method() | |||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 83 | else{ | ||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | eval { $self->$method() }; | |||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | die "Error executing $method for $stage of $phase: $@" if $@; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||
| 92 | #=============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||
| 94 | =head2 Building an Application | ||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||
| 96 | Below are functions most useful when actually writing a Application::Pipeline | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | subclassed application. | ||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||
| 99 | =head3 setPhases | ||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||
| 101 | $self->setPhases( qw( Initialization Main Teardown ) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||
| 103 | This method is typically invoked during a subclass's constructor to tell | ||||||||||||||||||||||||||||||||||||||||||||||
| 104 | Application::Pipeline what phases it will be running. If it is not called | ||||||||||||||||||||||||||||||||||||||||||||||
| 105 | before the C<run> method is invoked, the application will simply terminate | ||||||||||||||||||||||||||||||||||||||||||||||
| 106 | without having done anything. | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||
| 108 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 1 | ▶ | sub setPhases { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setPhases: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 1 | my( $self, @phases ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 113 | 1 | $self->{_phases} = \@phases; | |||||||||||||||||||||||||||||||||||||||||||||
| 114 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||
| 117 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||
| 119 | =head3 addHandler | ||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||
| 121 | $self->addHandler( $phase, $handler, $stage ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||
| 123 | Registers the given C<$handler> as a method to be run during C<$phase>. The | ||||||||||||||||||||||||||||||||||||||||||||||
| 124 | optional C<$stage> parameter specifies where along the phase the method is to | ||||||||||||||||||||||||||||||||||||||||||||||
| 125 | be run. Valid Phases are: | ||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||
| 127 | Initialization ParseRequest GenerateResponse SendResponse Teardown | ||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||
| 129 | Valid stages are: | ||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||
| 131 | FIRST EARLY MIDDLE LATE LAST | ||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||
| 133 | When no stage is specified, C<MIDDLE> is assumed. $handler may either be the name | ||||||||||||||||||||||||||||||||||||||||||||||
| 134 | of a method, or a code reference. Passing a name allows subclasses of the | ||||||||||||||||||||||||||||||||||||||||||||||
| 135 | application to override the method, while code references are slightly faster. | ||||||||||||||||||||||||||||||||||||||||||||||
| 136 | This is a trick taken directly from the CGI::Application folks. | ||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||
| 138 | B<Note:> Use the C<FIRST> and C<LAST> stages sparingly. Note that each time a | ||||||||||||||||||||||||||||||||||||||||||||||
| 139 | handler is added to the stage of a phase, it is added to the end of that stage. | ||||||||||||||||||||||||||||||||||||||||||||||
| 140 | C<FIRST> and C<LAST> are best used for handlers that are depended on by others, | ||||||||||||||||||||||||||||||||||||||||||||||
| 141 | but that do not themselves have dependencies. | ||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||
| 143 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | sub addHandler { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
addHandler: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | my( $self, $phase, $handler, $stage ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||
| 148 | warn "no phases established" and return undef | ||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | unless defined $self->{_phases}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
defined $self->{'_phases'} || warn('no phases established') && (return undef)
warn "no phases established" and return undef
MC/DC0%0/2
defined $self->{'_phases'} || warn('no phases established') && (return undef)
defined $self->{'_phases'}
warn "no phases established"
Truth table0%0/3
A || B
A= defined $self->{'_phases'}B= warn "no phases established"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||
| 151 | warn "unrecognized phase '$phase' for handler" and return undef | ||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | unless grep { $phase eq $_ } @{$self->{_phases}}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
grep({$phase eq $_;} @{$$self{'_phases'};}) || warn("unrecognized phase '${phase}' for handler") && (return undef)
warn "unrecognized phase '${phase}' for handler" and return undef
MC/DC0%0/2
grep({$phase eq $_;} @{$$self{'_phases'};}) || warn("unrecognized phase '${phase}' for handler") && (return undef)
grep({$phase eq $_;} @{$$self{'_phases'};})
warn "unrecognized phase '${phase}' for handler"
Truth table0%0/3
A || B
A= grep({$phase eq $_;} @{$$self{'_phases'};})B= warn "unrecognized phase '${phase}' for handler"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||
| 154 | warn "unrecognized phase stage '$stage'" and return undef | ||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | if $stage and not grep { $stage eq $_ } @phase_stages; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/8
$stage && !grep({$stage eq $_;} @Application::Pipeline::phase_stages) && (warn("unrecognized phase stage '${stage}'") && (return undef))
$stage and not grep({$stage eq $_;} @Application::Pipeline::phase_stages)
warn "unrecognized phase stage '${stage}'" and return undef
MC/DC0%0/3
$stage && !grep({$stage eq $_;} @Application::Pipeline::phase_stages) && (warn("unrecognized phase stage '${stage}'") && (return undef))
$stage
not grep({$stage eq $_;} @Application::Pipeline::phase_stages)
warn "unrecognized phase stage '${stage}'"
Truth table0%0/4
A and not(B) && C
A= $stageB= not grep({$stage eq $_;} @Application::Pipeline::phase_stages)C= warn "unrecognized phase stage '${stage}'"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | $stage ||= 'MIDDLE'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$stage ||= "MIDDLE"
MC/DC0%0/1
$stage ||= "MIDDLE"
$stage
Truth table0%0/2
A
A= $stage
| |||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | $self->{_plan}{$phase}{$stage} ||= []; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"_plan"}{$phase}{$stage} ||= []
MC/DC0%0/1
$self->{"_plan"}{$phase}{$stage} ||= []
$self->{"_plan"}{$phase}{$stage}
Truth table0%0/2
A
A= $self->{"_plan"}{$phase}{$stage}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | push @{$self->{_plan}{$phase}{$stage}},$handler; | |||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||
| 163 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||
| 165 | =head3 setPluginLocations | ||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||
| 167 | $self->setPluginLocations( qw( | ||||||||||||||||||||||||||||||||||||||||||||||
| 168 | Application::Pipeline::Services | ||||||||||||||||||||||||||||||||||||||||||||||
| 169 | WWW::Pipeline::Services | ||||||||||||||||||||||||||||||||||||||||||||||
| 170 | )); | ||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||
| 172 | It is possible to load plugins from certain predetermined namespaces in such | ||||||||||||||||||||||||||||||||||||||||||||||
| 173 | a way that you don't have to specify the fully qualified namespace. After this | ||||||||||||||||||||||||||||||||||||||||||||||
| 174 | method is called, any time a plugin is loaded it first will see if that plugin | ||||||||||||||||||||||||||||||||||||||||||||||
| 175 | exists by concatenating its name with the namespaces you provided, in the order | ||||||||||||||||||||||||||||||||||||||||||||||
| 176 | in which you provided them. Failing that, it will see if the plugin has a fully | ||||||||||||||||||||||||||||||||||||||||||||||
| 177 | qualified package name before giving up on loading. | ||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||
| 179 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 1 | ▶ | sub setPluginLocations { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setPluginLocations: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 1 | my( $self, @locations ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||
| 184 | $self->{_plugin_locations} = [ | ||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | grep /^[A-Za-z_]\w*(::[A-Za-z_]\w*)*$/, @locations | |||||||||||||||||||||||||||||||||||||||||||||
| 186 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||
| 189 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||
| 191 | =head3 loadPlugin | ||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||
| 193 | $self->loadPlugin( $package, @arguments ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||
| 195 | Takes and tries to load the provided C<$package>. unless the | ||||||||||||||||||||||||||||||||||||||||||||||
| 196 | C<$nonstandard_namespace> flag is set it will assume the package needs the | ||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 'Application::Pipeline::Services' namespace appended to it. Upon requiring the module | ||||||||||||||||||||||||||||||||||||||||||||||
| 198 | it passes \@arguments to the package's C<load> method. For more information | ||||||||||||||||||||||||||||||||||||||||||||||
| 199 | refer to the section below on writing plugins. | ||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||
| 201 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | sub loadPlugin { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
loadPlugin: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | my( $self, $plugin, @args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | return 1 if defined $self->{_plugins}{$plugin}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | if( $self->{_plugin_locations} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | foreach my $namespace ( @{$self->{_plugin_locations}}, '' ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | my $package = $namespace | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 211 | ? $namespace .'::'.$plugin | ||||||||||||||||||||||||||||||||||||||||||||||
| 212 | : $plugin; | ||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | eval "require $package"; | |||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | die $@ if $@ and $@ !~ /^Can't locate/; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$@ and not $@ =~ /^Can't locate/
MC/DC0%0/2
$@ and not $@ =~ /^Can't locate/
$@
not $@ =~ /^Can't locate/
Truth table0%0/3
A and not(B)
A= $@B= not $@ =~ /^Can't locate/
| |||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | next if $@; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | warn "Nothing to load from $plugin" and return undef | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
UNIVERSAL::can($package, 'load') || warn("Nothing to load from $plugin") && (return undef)
warn "Nothing to load from $plugin" and return undef
MC/DC0%0/2
UNIVERSAL::can($package, 'load') || warn("Nothing to load from $plugin") && (return undef)
UNIVERSAL::can($package, 'load')
warn "Nothing to load from $plugin"
Truth table0%0/3
A || B
A= UNIVERSAL::can($package, 'load')B= warn "Nothing to load from $plugin"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 220 | unless UNIVERSAL::can( $package, 'load' ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | $package->load( $self, @args ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$package->load($self, @args) || warn("Failed to load plugin '${plugin}'") && (return undef)
warn "Failed to load plugin '${plugin}'" and return undef
MC/DC0%0/2
$package->load($self, @args) || warn("Failed to load plugin '${plugin}'") && (return undef)
$package->load($self, @args)
warn "Failed to load plugin '${plugin}'"
Truth table0%0/3
A || B
A= $package->load($self, @args)B= warn "Failed to load plugin '${plugin}'"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 223 | or warn "Failed to load plugin '$plugin'" and return undef; | ||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | $self->{_plugins}{$plugin} = $package; | |||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | warn "Failed to load plugin '$plugin': could not locate file"; | |||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||
| 234 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||
| 236 | =head3 loadPlugins | ||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||
| 238 | $self->loadPlugins( 'Foo','Bar',....) | ||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||
| 240 | A shortcut method for loading plugins that take no arguments. | ||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||
| 242 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | sub loadPlugins { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
loadPlugins: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | my( $self, @packages ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | my $success_count = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | $success_count += $self->loadPlugin($_) foreach @packages; | |||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | return $success_count; | |||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||
| 252 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||
| 254 | =head3 unloadPlugins | ||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||
| 256 | $self->unloadPlugins( 'Foo','Bar',...) | ||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||
| 258 | While it will likely be rare that an application would want to manually remove | ||||||||||||||||||||||||||||||||||||||||||||||
| 259 | a plugin before it is finished running, this method will do just that to the | ||||||||||||||||||||||||||||||||||||||||||||||
| 260 | named plugins. It does so by calling the plugin's package's C<unload()> method | ||||||||||||||||||||||||||||||||||||||||||||||
| 261 | if one exists, and deleting the plugin from the application's registry. | ||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||
| 263 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | sub unloadPlugins { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unloadPlugins: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my( $self, @packages ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | foreach my $plugin ( @packages ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | if( my $package = $self->{_plugins}{$plugin} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | $package->unload( $self ) if UNIVERSAL::can($package, 'unload'); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | delete $self->{_plugins}{$plugin}; | |||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||
| 276 | #=============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||
| 278 | =head2 Writing Plugins | ||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||
| 280 | Plugins in their simplest form are packages which have two methods: C<load()> | ||||||||||||||||||||||||||||||||||||||||||||||
| 281 | and, optionally, C<unload()>. The former is called when the application calls | ||||||||||||||||||||||||||||||||||||||||||||||
| 282 | C<loadPlugin>, and the latter on C<unloadPlugin()> | ||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||
| 284 | C<load> receives the plugin's package name, a reference to the application, and | ||||||||||||||||||||||||||||||||||||||||||||||
| 285 | whatever arguments may have been sent through C<loadPlugin>. | ||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||
| 287 | C<unload> receives the plugin's package name and a reference to the application. | ||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||
| 289 | =head3 addServices | ||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||
| 291 | $pipeline->addServices( name => $object, name2 => sub{ },... ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||
| 293 | This method is most commonly used within the C<load> method of a plugin. | ||||||||||||||||||||||||||||||||||||||||||||||
| 294 | Services are either a subroutine that the application will adopt as one of its | ||||||||||||||||||||||||||||||||||||||||||||||
| 295 | own by the name specified, or a data structure (often objects) that the | ||||||||||||||||||||||||||||||||||||||||||||||
| 296 | application will make available under the specified name | ||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||
| 298 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 3 | ▶ | sub addServices { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
addServices: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 3 | my( $self, %services ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 3 | ▶ | while( my( $name, $service ) = each %services ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 7 | ▶ | next unless $name =~ /^[A-Za-z_]\w*$/; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 305 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 6 | *{ ref($self)."::$name" } = ( ref $service eq 'CODE' ) | |||||||||||||||||||||||||||||||||||||||||||||
| 308 | ? $service | ||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 6 | ▶ | : sub { return $service }; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 6 | $self->{_services}{$name} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 3 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||
| 316 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||
| 318 | =head3 dropServices | ||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||
| 320 | $pipeline->dropServices( name, name2,... ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||
| 322 | Probably a good idea to unregister the services you added as a plugin when your | ||||||||||||||||||||||||||||||||||||||||||||||
| 323 | C<unload()> method gets called. Also, rather than forcing the application to | ||||||||||||||||||||||||||||||||||||||||||||||
| 324 | manually call your unload method you may choose to register one of your methods | ||||||||||||||||||||||||||||||||||||||||||||||
| 325 | as a handler to be run during the Teardown phase of the application, so that you | ||||||||||||||||||||||||||||||||||||||||||||||
| 326 | can perform any cleanup you might require. | ||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||
| 328 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 1 | ▶ | sub dropServices { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dropServices: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 1 | my( $self, @services ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 1 | foreach my $service ( @services ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 334 | 1 | ▶ | next unless defined $self->{_services}{$service}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 1 | my $old; | |||||||||||||||||||||||||||||||||||||||||||||
| 337 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 1 | $old = \*{ ref($self)."::$service" }; | |||||||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 1 | my $new = gensym; | |||||||||||||||||||||||||||||||||||||||||||||
| 343 | 1 | *$new = *$old{$_} foreach ( grep { defined *$old{$_} } qw( SCALAR ARRAY HASH IO FORMAT ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 344 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 1 | *{ ref($self)."::$service" } = *$new; | |||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 1 | delete $self->{_services}{$service}; | |||||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||
| 354 | #=============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||
| 356 | =head2 Building the Pipeline Plan | ||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||
| 358 | When the run method gets called, the first thing the method does is build the | ||||||||||||||||||||||||||||||||||||||||||||||
| 359 | list of methods to be run. First, it checks for a C<%plan> varaible in the | ||||||||||||||||||||||||||||||||||||||||||||||
| 360 | current package. | ||||||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||||||
| 362 | Any method entry in a phase of the plan with the value of 'SUPER' causes the | ||||||||||||||||||||||||||||||||||||||||||||||
| 363 | application to go looking up the inheritence tree for packages (that are | ||||||||||||||||||||||||||||||||||||||||||||||
| 364 | themselves descendents of Application::Pipeline) that have a %plan, and substitutes the | ||||||||||||||||||||||||||||||||||||||||||||||
| 365 | superclass' plan for that phase in the place of the 'SUPER' placeholder. This | ||||||||||||||||||||||||||||||||||||||||||||||
| 366 | allows the designer of the current application to choose where and whether to | ||||||||||||||||||||||||||||||||||||||||||||||
| 367 | include the plan of a superclass for a given phase. | ||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||
| 369 | The appliation will put all of the plan methods found into the C<MIDDLE> stage | ||||||||||||||||||||||||||||||||||||||||||||||
| 370 | of the phase. | ||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||
| 372 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | ▶ | sub _buildPlan { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_buildPlan: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | $self->{_phases} ||= []; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"_phases"} ||= []
MC/DC0%0/1
$self->{"_phases"} ||= []
$self->{"_phases"}
Truth table0%0/2
A
A= $self->{"_phases"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | foreach my $phase ( @{$self->{_phases}} ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | $self->{_plan}{$phase}{MIDDLE} ||= []; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"_plan"}{$phase}{"MIDDLE"} ||= []
MC/DC0%0/1
$self->{"_plan"}{$phase}{"MIDDLE"} ||= []
$self->{"_plan"}{$phase}{"MIDDLE"}
Truth table0%0/2
A
A= $self->{"_plan"}{$phase}{"MIDDLE"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | $self->_buildPhase( $phase, ref $self ); | |||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||
| 384 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | ▶ | sub _buildPhase{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_buildPhase: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | my( $self, $phase, @packages ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | foreach my $package( @packages ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | my %plan = eval '%'.$package .'::plan'; | |||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | my @isa = grep { UNIVERSAL::isa($_,'Application::Pipeline') } | |||||||||||||||||||||||||||||||||||||||||||||
| 391 | eval '@'.$package.'::ISA'; | ||||||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | unless( %plan && $plan{$phase} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
%plan and $plan{$phase}
MC/DC0%0/2
%plan and $plan{$phase}
%plan
$plan{$phase}
Truth table0%0/3
A and B
A= %planB= $plan{$phase}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | $self->_buildPhase( $phase, @isa ) if @isa; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | foreach my $method ( @{$plan{$phase}} ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | ▶ | if( not ref $method and $method eq 'SUPER' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not ref $method and $method eq "SUPER"
MC/DC0%0/2
not ref $method and $method eq "SUPER"
not ref $method
$method eq "SUPER"
Truth table0%0/3
not(A) and B
A= not ref $methodB= $method eq "SUPER"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | $self->_buildPhase( $phase, @isa ) if @isa; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | push @{$self->{_plan}{$phase}{MIDDLE}}, $method; | |||||||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||
| 410 | #======== | ||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||
| 413 | =head2 Acknowledgements | ||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||
| 415 | I would like to thank the members of the CGI::Application mailing list that have | ||||||||||||||||||||||||||||||||||||||||||||||
| 416 | participated in the discussions that resulted in this module, particularly | ||||||||||||||||||||||||||||||||||||||||||||||
| 417 | Rob Kinyon, Cees Hek, Mark Stosberg, Michael Peters and David Naughton. And of | ||||||||||||||||||||||||||||||||||||||||||||||
| 418 | course to Jesse Erlbaum for introducing me to sane methods of web development | ||||||||||||||||||||||||||||||||||||||||||||||
| 419 | with CGI::Application. | ||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||
| 421 | =head2 Authors | ||||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||
| 423 | Stephen Howard <stephen@thunkit.com> | ||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||
| 425 | =head2 License | ||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||
| 427 | This module may be distributed under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||||||
| 429 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||