blib/lib/VM/EC2/DB/Event/Category.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 32 CC 3 SCAR 17.5
CC
3
Cov
0%
EventCategories
12.0
valid_fields
2.0
as_string
2.0
CRAP 5.8
1 package VM::EC2::DB::Event::Category;
2  
3 =head1 NAME
4  
5 VM::EC2::DB::Event::Category - An RDS Database Event Category
6  
7 =head1 SYNOPSIS
8  
9 use VM::EC2;
10  
11 $ec2 = VM::EC2->new(...);
12 $db_cat = $ec2->describe_event_categories(-source_type => 'db-instance');
13 print $_,"\n" foreach $db_cat->EventCategories;
14  
15 =head1 DESCRIPTION
16  
17 This object represents an RDS Event Category. It is the resultant output of
18 the VM::EC2->describe_event_categories() function.
19  
20 =head1 STRING OVERLOADING
21  
22 When used in a string context, this object will output the source type
23 followed by a comma delimited list of event categories.
24  
25 =head1 SEE ALSO
26  
27 L<VM::EC2>
28 L<VM::EC2::Generic>
29 L<VM::EC2::DB::Instance>
30  
31 =head1 AUTHOR
32  
33 Lance Kinley E<lt>lkinley@loyaltymethods.comE<gt>.
34  
35 Copyright (c) 2013 Loyalty Methods, Inc.
36  
37 This package and its accompanying libraries is free software; you can
38 redistribute it and/or modify it under the terms of the GPL (either
39 version 1, or at your option, any later version) or the Artistic
40 License 2.0. Refer to LICENSE for the full license text. In addition,
41 please see DISCLAIMER.txt for disclaimers of warranty.
42  
43 =cut
44  
45 use strict;
46 use base 'VM::EC2::Generic';
47  
48 use overload '""' => sub { shift->as_string },
49 fallback => 1;
50  
51 sub valid_fields {
52 my $self = shift;
53 return qw(SourceType EventCategories);
54 }
55  
56 sub EventCategories {
57 my $self = shift;
58 my $cats = $self->SUPER::EventCategories;
59 return unless $cats;
60 $cats = $cats->{EventCategory};
61 return ref $cats eq 'ARRAY' ? @$cats : ($cats);
62 }
63  
64 sub as_string {
65 my $self = shift;
66 $self->SourceType . ' : ' . join(',',$self->EventCategories)
67 }
68  
69 1;