| 1 | package SRS::EPP::Command::PayloadClass; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | sub payload_class { | ||||||||||
| 6 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
payload_class: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 7 | 0 | my $class = ref $self; | |||||||||
| 8 | 0 | my $root_element = shift; | |||||||||
| 9 | 0 | my $xmlns = shift; | |||||||||
| 10 | 0 | our $payload_classes; | |||||||||
| 11 | 0 | ▶ | if ( !$payload_classes->{$class} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 12 | $payload_classes->{$class} = { | ||||||||||
| 13 | map { | ||||||||||
| 14 | 0 | ▶ | $_->can("xmlns") ? | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | ($_->action.":".$_->xmlns => $_) | ||||||||||
| 16 | : (); | ||||||||||
| 17 | } $self->plugins, | ||||||||||
| 18 | }; | ||||||||||
| 19 | #print "payload classes for $class are: ".Dumper($payload_classes->{$class}); | ||||||||||
| 20 | } | ||||||||||
| 21 | 0 | $payload_classes->{$class}{ $root_element.":".$xmlns }; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | sub REBLESS { | ||||||||||
| 25 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
REBLESS: not called CC=5 SCAR=30.3
Pod
undocumented
| |||||||||||
| 26 | 0 | ▶ | if ( my $epp = $self->message ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 0 | ▶ | my $payload = eval { $epp->message->argument->payload } or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | # print "payload is $payload\n"; | ||||||||||
| 29 | |||||||||||
| 30 | # ASSERT($payload->does("PRANG::Graph")); | ||||||||||
| 31 | |||||||||||
| 32 | 0 | my $root_element = $payload->root_element; | |||||||||
| 33 | 0 | my $xmlns = $payload->xmlns; | |||||||||
| 34 | |||||||||||
| 35 | # print "looking for plugin that handles $root_element ($xmlns)\n"; | ||||||||||
| 36 | |||||||||||
| 37 | 0 | ▶ | if (my $class = $self->payload_class($root_element, $xmlns)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | # print "reblessing $self into $class\n"; | ||||||||||
| 39 | 0 | bless $self, $class; | |||||||||
| 40 | 1 | ▶ | no strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 41 | 0 | ▶ | $self->REBLESS if defined &{"${class}::REBLESS"}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | } | ||||||||||
| 43 | } | ||||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | 1 | 1; | |||||||||