| 1 | package Net::Amazon::S3::ACL::Grant::ID; | ||||||||||
| 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( ID displayname )); | |||||||||
| 10 | |||||||||||
| 11 | # Module implementation here | ||||||||||
| 12 | 1 | ▶ | sub parse_grantee { | ||||||||
|
Subroutine
parse_grantee: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 13 | 1 | my ($self, $xpc, $node) = @_; | |||||||||
| 14 | |||||||||||
| 15 | 1 | ▶ | my $id = $xpc->findvalue('.//s3:Grantee/s3:ID', $node) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | or croak 'no ID grant in provided node'; | ||||||||||
| 17 | 1 | $self->ID($id); | |||||||||
| 18 | 1 | $self->key($id); | |||||||||
| 19 | |||||||||||
| 20 | 1 | my $name = $xpc->findvalue('.//s3:Grantee/s3:DisplayName', $node); | |||||||||
| 21 | 1 | $self->displayname($name); | |||||||||
| 22 | |||||||||||
| 23 | 1 | return $self; | |||||||||
| 24 | } ## end sub _parse_acl_grant | ||||||||||
| 25 | |||||||||||
| 26 | 43 | ▶ | sub populate_from_target { | ||||||||
|
Subroutine
populate_from_target: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 27 | 43 | my ($self, $target) = @_; | |||||||||
| 28 | 43 | $self->ID($target); | |||||||||
| 29 | 43 | $self->displayname(undef); | |||||||||
| 30 | 43 | $self->key($target); | |||||||||
| 31 | 43 | return $self; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 45 | ▶ | sub _set_key { $_[0]->key($_[0]->ID()); } | ||||||||
|
Subroutine
_set_key: called CC=1 SCAR=0.0
| |||||||||||
| 35 | |||||||||||
| 36 | 1 | ▶ | sub stringify_grantee { | ||||||||
|
Subroutine
stringify_grantee: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 37 | 1 | my ($self) = @_; | |||||||||
| 38 | |||||||||||
| 39 | # The DisplayName attribute is actually ignored by AWS, but for | ||||||||||
| 40 | # sake of completeness we're including it here | ||||||||||
| 41 | 1 | my $id = $self->ID(); | |||||||||
| 42 | 1 | my $displayname = $self->displayname(); | |||||||||
| 43 | 1 | ▶ | $displayname = '' unless defined $displayname; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 1 | return <<"END_OF_GRANTEE"; | |||||||||
| 45 | <Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"> | ||||||||||
| 46 | <ID>$id</ID> | ||||||||||
| 47 | <DisplayName>$displayname</DisplayName> | ||||||||||
| 48 | </Grantee> | ||||||||||
| 49 | END_OF_GRANTEE | ||||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 3 | 1; # Magic true value required at end of module | |||||||||
| 53 | __END__ | ||||||||||