ACL/Grant/Email.pm

filter: Statementstmt 100% 31 / 31 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 100% 3 / 3 totaltotal 100% 47 / 47 CC 3 SCAR 3.1
CC
3
Cov
100%
parse_grantee
2.0
populate_from_target
2.0
BEGIN
1.0
CRAP 1.4
« ACL/Grant/ID.pm ↑ Summary ACL/XMLHelper.pm »
1 package Net::Amazon::S3::ACL::Grant::Email;
2  
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use English qw( -no_match_vars );
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 ▶use base qw(Net::Amazon::S3::ACL::Grant);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 __PACKAGE__->mk_accessors(qw( email ));
10  
11 # Module implementation here
12 3 ▶sub parse_grantee {
Subroutine parse_grantee: called CC=2 SCAR=6.9
Pod documented
13 3 my ($self, $xpc, $node) = @_;
14  
15 3 ▶ my $email = $xpc->findvalue('.//s3:Grantee/s3:EmailAddress', $node)
Branch: 1 branch
BranchTrueFalseTotal
my $email = $xpc->findvalue(".//s3:Grantee/s3:EmailAddress", $node) or croak("no email grant in provided node") 1 2 3
16 or croak "no email grant in provided node";
17 1 $self->email($email);
18 1 $self->key($email);
19  
20 1 return $self;
21 } ## end sub _parse_acl_grant
22  
23 48 ▶sub populate_from_target {
Subroutine populate_from_target: called CC=2 SCAR=6.9
Pod documented
24 48 my ($self, $target) = @_;
25 48 ▶ croak "$target is not an email address" unless $target =~ /@/;
Branch: 1 branch
BranchTrueFalseTotal
unless $target =~ /@/ 46 2 48
26 2 $self->email($target);
27 2 $self->key($target);
28 2 return $self;
29 }
30  
31 3 ▶sub _set_key { $_[0]->key($_[0]->email()); }
Subroutine _set_key: called CC=1 SCAR=0.0
32  
33 1 ▶sub stringify_grantee {
Subroutine stringify_grantee: called CC=1 SCAR=0.0
Pod documented
34 1 my ($self) = @_;
35 1 my $email = $self->email();
36 1 return <<"END_OF_GRANTEE";
37 <Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AmazonCustomerByEmail">
38 <EmailAddress>$email</EmailAddress>
39 </Grantee>
40 END_OF_GRANTEE
41 }
42  
43 3 1; # Magic true value required at end of module
44 __END__
« ACL/Grant/ID.pm ↑ Summary ACL/XMLHelper.pm »