R53/ResourceRecordSet.pm untested

filter: Statementstmt 0.0% 0 / 47 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 24 MC/DCmcdc 0.0% 0 / 12 Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 107 CC 7 SCAR 32.4
CC
7
Cov
0%
_build_r53_rrs_type
56.0
is_standard_record_set
2.0
BEGIN
2.0
CRAP 25.6
1 #
2 # This file is part of Net-Amazon-R53
3 #
4 # This software is Copyright (c) 2012 by Campus Explorer, Inc.
5 #
6 # This is free software, licensed under:
7 #
8 # The GNU Lesser General Public License, Version 2.1, February 1999
9 #
10 package Net::Amazon::R53::ResourceRecordSet;
11 {
12 $Net::Amazon::R53::ResourceRecordSet::VERSION = '0.002'; # TRIAL
13 }
14  
15 # ABSTRACT: A representation of a ResourceRecordSet
16  
17 use Moose;
18 use namespace::autoclean;
19 use Moose::Util::TypeConstraints 'enum';
20 use MooseX::AlwaysCoerce;
21 use MooseX::AttributeShortcuts 0.017;
22 use MooseX::Types::Moose ':all';
23 use MooseX::Types::Common::Numeric ':all';
24 use MooseX::Types::Common::String ':all';
25  
26 extends 'Net::Amazon::R53::ResourceRecordSet::Stub';
27  
28 with 'MooseX::Traitor';
29 with
30 'Net::Amazon::R53::Role::NewFromRawData',
31 'Net::Amazon::R53::Role::ParentR53',
32 ;
33  
34 has r53_rrs_type => (
35 is => 'lazy',
36 isa => enum [ qw{ standard alias weighted weighted_latency latency } ],
37 );
38  
39 # XXX this feels... bad
40  
41 sub _build_r53_rrs_type {
42 my $self = shift @_;
43  
44 my $has_set_id = $self->has_set_identifier;
45 my $has_alias = $self->has_alias_target;
46 my $has_weight = $self->has_weight;
47 my $has_region = $self->has_region;
48  
49 return 'standard'
50 unless $has_set_id || $has_alias || $has_weight || $has_region;
51  
52 if ($has_alias) {
53  
54 confess 'invalid rrs type'
55 if $has_set_id || $has_weight || $has_region;
56  
57 return 'alias';
58 }
59  
60 ### assert: !$has_alias;
61  
62 # at least one remaining is false
63 confess 'invalid rrs type'
64 if $has_region && $has_set_id && $has_weight;
65  
66 return 'weighted_latency'
67 if $has_weight && $has_set_id;
68  
69 ### assert: !$has_region
70  
71 return 'weighted'
72 if $has_weight;
73  
74 ### assert: $has_region
75 return 'latency';
76 }
77  
78 sub is_standard_record_set { shift->r53_rrs_type eq 'standard' }
79  
80 __PACKAGE__->meta->make_immutable;
81 !!42;
82  
83 __END__