WWW/eNom/Role/Command.pm

filter: Statementstmt 61.7% 29 / 47 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 53.3% 8 / 15 Podpod 100% 1 / 1 totaltotal 56.7% 38 / 67 CC 3 SCAR 9.0
CC
3
Cov
57%
__ANON__
6.0
__ANON__
6.0
__ANON__
2.0
CRAP 2.5
« WWW/eNom/Role/Command/Domain/Transfer.pm ↑ Summary WWW/eNom/IRTPDetail.pm »
1 package WWW::eNom::Role::Command;
2  
3 45 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 45 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 45 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 45 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 45 ▶use MooseX::Params::Validate;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 45 ▶use WWW::eNom::Types qw( HashRef Str );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 45 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 45 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 45 requires 'response_type';
16 45 with 'WWW::eNom::Role::Command::Raw',
17 'WWW::eNom::Role::Command::Contact',
18 'WWW::eNom::Role::Command::Domain',
19 'WWW::eNom::Role::Command::Domain::Availability',
20 'WWW::eNom::Role::Command::Domain::Registration',
21 'WWW::eNom::Role::Command::Domain::Transfer',
22 'WWW::eNom::Role::Command::Domain::PrivateNameServer',
23 'WWW::eNom::Role::Command::Service';
24  
25 45 our $VERSION = 'v2.7.0'; # VERSION
26 # ABSTRACT: Submission of eNom Commands
27  
28 # Used to force xml_simple response type and restore the existing type afterwards
29 0 ▶around submit => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
30 0 my ( $orig, $self, $args ) = @_;
31  
32 0 my $current_response_type = $self->response_type;
33  
34 0 my $response;
35 0 ▶ try {
Subroutine __ANON__: not called CC=2 SCAR=17.9
36 0 ▶ if( $current_response_type ne 'xml_simple' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($current_response_type ne "xml_simple") 0 0 0
37 0 $self->response_type( 'xml_simple' );
38 }
39  
40 0 $response = $self->$orig( $args );
41 }
42 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
43 0 croak $_;
44 }
45 0 ▶ finally {
Subroutine __ANON__: not called CC=2 SCAR=17.9
46 0 ▶ if( $self->response_type ne $current_response_type ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->response_type ne $current_response_type) 0 0 0
47 0 $self->response_type( $current_response_type );
48 }
49 0 };
50 45 };
51  
52 0 ▶sub submit {
Subroutine submit: not called CC=1 SCAR=6.9
Pod documented
53 0 my $self = shift;
54 0 my ( %args ) = validated_hash(
55 \@_,
56 method => { isa => Str },
57 params => { isa => HashRef },
58 );
59  
60 0 my $response;
61 0 ▶ try {
Subroutine __ANON__: not called CC=1 SCAR=6.9
62 0 my $method = $args{method};
63 0 $response = $self->$method( $args{params} );
64 }
65 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
66 0 croak "Error making eNom request: $_";
67 0 };
68  
69 0 return $response;
70 }
71  
72 45 1;
73  
74 __END__
« WWW/eNom/Role/Command/Domain/Transfer.pm ↑ Summary WWW/eNom/IRTPDetail.pm »