| 1 | package Net::Amazon::S3::Operation::Objects::List::Response; | ||||||||||
| 2 | # ABSTRACT: An internal class to list a bucket (List Objects Version 1) | ||||||||||
| 3 | 99 | $Net::Amazon::S3::Operation::Objects::List::Response::VERSION = '0.992'; | |||||||||
| 4 | 99 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 99 | extends 'Net::Amazon::S3::Response'; | |||||||||
| 7 | |||||||||||
| 8 | 5 | ▶ | sub bucket { | ||||||||
|
Subroutine
bucket: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 9 | 5 | $_[0]->_data->{bucket}; | |||||||||
| 10 | } | ||||||||||
| 11 | |||||||||||
| 12 | 5 | ▶ | sub prefix { | ||||||||
|
Subroutine
prefix: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 13 | 5 | $_[0]->_data->{prefix}; | |||||||||
| 14 | } | ||||||||||
| 15 | |||||||||||
| 16 | 5 | ▶ | sub marker { | ||||||||
|
Subroutine
marker: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 17 | 5 | $_[0]->_data->{marker}; | |||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | 8 | ▶ | sub next_marker { | ||||||||
|
Subroutine
next_marker: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 21 | 8 | $_[0]->_data->{next_marker}; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 5 | ▶ | sub max_keys { | ||||||||
|
Subroutine
max_keys: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 25 | 5 | $_[0]->_data->{max_keys}; | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 8 | ▶ | sub is_truncated { | ||||||||
|
Subroutine
is_truncated: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 29 | 8 | $_[0]->_data->{is_truncated}; | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 9 | ▶ | sub contents { | ||||||||
|
Subroutine
contents: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 33 | 9 | @{ $_[0]->_data->{contents} }; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 2 | ▶ | sub common_prefixes { | ||||||||
|
Subroutine
common_prefixes: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 37 | 2 | @{ $_[0]->_data->{common_prefixes} }; | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 9 | ▶ | sub _parse_data { | ||||||||
|
Subroutine
_parse_data: called CC=5 SCAR=16.1
| |||||||||||
| 41 | 9 | my ($self) = @_; | |||||||||
| 42 | |||||||||||
| 43 | 9 | my $xpc = $self->xpath_context; | |||||||||
| 44 | |||||||||||
| 45 | 9 | my $data = { | |||||||||
| 46 | bucket => scalar $xpc->findvalue ("/s3:ListBucketResult/s3:Name"), | ||||||||||
| 47 | prefix => scalar $xpc->findvalue ("/s3:ListBucketResult/s3:Prefix"), | ||||||||||
| 48 | marker => scalar $xpc->findvalue ("/s3:ListBucketResult/s3:Marker"), | ||||||||||
| 49 | next_marker => scalar $xpc->findvalue ("/s3:ListBucketResult/s3:NextMarker"), | ||||||||||
| 50 | max_keys => scalar $xpc->findvalue ("/s3:ListBucketResult/s3:MaxKeys"), | ||||||||||
| 51 | is_truncated => scalar $xpc->findvalue ("/s3:ListBucketResult/s3:IsTruncated") eq 'true', | ||||||||||
| 52 | contents => [], | ||||||||||
| 53 | common_prefixes => [], | ||||||||||
| 54 | }; | ||||||||||
| 55 | |||||||||||
| 56 | 9 | for my $content ($xpc->findnodes ("/s3:ListBucketResult/s3:Contents")) { | |||||||||
| 57 | 12 | push @{ $data->{contents} }, { | |||||||||
| 58 | key => scalar $xpc->findvalue ("./s3:Key", $content), | ||||||||||
| 59 | last_modified => scalar $xpc->findvalue ("./s3:LastModified", $content), | ||||||||||
| 60 | etag => scalar $xpc->findvalue ("./s3:ETag", $content), | ||||||||||
| 61 | size => scalar $xpc->findvalue ("./s3:Size", $content), | ||||||||||
| 62 | storage_class => scalar $xpc->findvalue ("./s3:StorageClass", $content), | ||||||||||
| 63 | owner => { | ||||||||||
| 64 | id => $xpc->findvalue ("./s3:Owner/s3:ID", $content), | ||||||||||
| 65 | displayname => $xpc->findvalue ("./s3:Owner/s3:DisplayName", $content), | ||||||||||
| 66 | }, | ||||||||||
| 67 | }; | ||||||||||
| 68 | 12 | $data->{contents}[-1]{etag} =~ s/^"|"$//g; | |||||||||
| 69 | } | ||||||||||
| 70 | |||||||||||
| 71 | 9 | for my $delimiter ($xpc->findnodes ("/s3:ListBucketResult/s3:Delimiter")) { | |||||||||
| 72 | 4 | $data->{delimiter} = $xpc->findvalue ('.', $delimiter); | |||||||||
| 73 | } | ||||||||||
| 74 | |||||||||||
| 75 | 9 | ▶ | if (defined $data->{delimiter}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 76 | 4 | my $strip_delim = length $data->{delimiter}; | |||||||||
| 77 | |||||||||||
| 78 | 4 | for my $common_prefix ($xpc->findnodes ("/s3:ListBucketResult/s3:CommonPrefixes")) { | |||||||||
| 79 | 6 | my $prefix = $xpc->findvalue ('./s3:Prefix', $common_prefix); | |||||||||
| 80 | 6 | $prefix = substr $prefix, 0, -$strip_delim; | |||||||||
| 81 | 6 | push @{ $data->{common_prefixes} }, $prefix; | |||||||||
| 82 | } | ||||||||||
| 83 | } | ||||||||||
| 84 | |||||||||||
| 85 | 9 | return $data; | |||||||||
| 86 | } | ||||||||||
| 87 | |||||||||||
| 88 | 99 | 1; | |||||||||
| 89 | |||||||||||
| 90 | __END__ | ||||||||||