S3/Request/CreateBucket.pm

filter: Statementstmt 100% 15 / 15 Branchbran 100% 4 / 4 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 1 totaltotal 96.4% 27 / 28 CC 4 SCAR 8.5
CC
4
Cov
100%
request
3.0
__ANON__
2.0
BEGIN
1.0
CRAP 2.3
« S3/File.pm ↑ Summary S3.pm »
1  
2 package AWS::S3::Request::CreateBucket;
3 6 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 6 with 'AWS::S3::Roles::Request';
6  
7 6 has 'bucket' => (
8 is => 'ro',
9 isa => 'AWS::S3::BucketName',
10 required => 1,
11 );
12  
13 has 'location' => (
14 is => 'ro',
15 isa => 'Maybe[Str]',
16 lazy => 1,
17 required => 0,
18 16 ▶ default => sub { shift->s3->region || $ENV{AWS_REGION} },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
(shift())->s3->region or $ENV{"AWS_REGION"} 12 4 16
19 6 );
20  
21 6 has '+_expect_nothing' => ( default => 1 );
22  
23 19 ▶sub request {
Subroutine request: called CC=3 SCAR=11.0
Pod undocumented
24 19 my $s = shift;
25  
26 # By default the bucket is put in us-east-1. But if you _ask_ for
27 # us-east-1 you get an error.
28 19 my $xml = q{};
29 19 ▶ if ( $s->location && $s->location ne 'us-east-1' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($s->location and $s->location ne "us-east-1") 3 16 19
Condition100%3/3
$s->location and $s->location ne "us-east-1"
!ll&&!rl&&r
4123
MC/DC100%2/2
$s->location and $s->location ne "us-east-1"
$s->location $s->location ne "us-east-1"
Truth table100%3/3
A and B
A= $s->locationB= $s->location ne "us-east-1"
ABresult
0X0
100
111
30 3 $xml = <<"XML";
31 <CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
32 3 <LocationConstraint>@{[ $s->_xml_escape( $s->location ) ]}</LocationConstraint>
33 </CreateBucketConfiguration>
34 XML
35 }
36  
37 19 return $s->_send_request(
38 PUT => URI->new( $s->protocol . '://' . $s->bucket . '.' . $s->endpoint . '/' ) => {
39 Date => $s->_http_date,
40 'content-type' => 'text/plain',
41 },
42 $xml
43 );
44 }
45  
46 6 __PACKAGE__->meta->make_immutable;
« S3/File.pm ↑ Summary S3.pm »