| 1 | 1 | ▶ | use 5.008; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 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 | |||||||||||
| 5 | package Data::Conveyor::Ticket::Payload::Instruction::Factory; | ||||||||||
| 6 | 1 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | $Data::Conveyor::Ticket::Payload::Instruction::Factory::VERSION = '1.103130'; | |||||||||
| 8 | } | ||||||||||
| 9 | # ABSTRACT: Stage-based conveyor-belt-like ticket handling system | ||||||||||
| 10 | |||||||||||
| 11 | # ptags: DCTPIF | ||||||||||
| 12 | 1 | ▶ | use Error::Hierarchy::Util 'assert_defined'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 1 | ▶ | use parent 'Class::Scaffold::Factory'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 1 | ▶ | use constant INSTRUCTION_CLASS_FOR_NAME => | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 1 | (clear => 'Data::Conveyor::Ticket::Payload::Instruction::Clear',); | |||||||||
| 16 | |||||||||||
| 17 | 0 | ▶ | sub gen_instruction { | ||||||||
|
Subroutine
gen_instruction: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 18 | 0 | my ($self, $name, %args) = @_; | |||||||||
| 19 | 0 | assert_defined $name, 'instruction name'; | |||||||||
| 20 | |||||||||||
| 21 | # Some instruction classes have a generic structure, they're called | ||||||||||
| 22 | # Data::Conveyor::Ticket::Payload::Instruction::value_person_organization | ||||||||||
| 23 | # and such. They're generated in Data::Conveyor::Environment, so they're | ||||||||||
| 24 | # not in file, so we don't need to load_class() them. | ||||||||||
| 25 | 0 | ▶ | if (grep { $_ eq $name } $self->delegate->generic_instruction_classes) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 0 | my $class = $self->delegate->INSTRUCTION_CLASS_BASE() . '::' . $name; | |||||||||
| 27 | 0 | return $class->new( | |||||||||
| 28 | storage_type => $self->storage_type, | ||||||||||
| 29 | %args | ||||||||||
| 30 | ); | ||||||||||
| 31 | } else { | ||||||||||
| 32 | |||||||||||
| 33 | # If it is not a generic value object instruction, go through the | ||||||||||
| 34 | # normal way of generatic an object. | ||||||||||
| 35 | 0 | return $self->gen_handler(INSTRUCTION_CLASS_FOR_NAME => [$name], %args); | |||||||||
| 36 | } | ||||||||||
| 37 | } | ||||||||||
| 38 | 1 | 1; | |||||||||
| 39 | |||||||||||
| 40 | |||||||||||
| 41 | __END__ | ||||||||||