Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^5: Need to print bucket and filename which is uploaded on S3 storage

by Corion (Pope)
on Aug 21, 2019 at 08:12 UTC ( #11104785=note: print w/replies, xml ) Need Help??


in reply to Re^4: Need to print bucket and filename which is uploaded on S3 storage
in thread Need to print bucket and filename which is uploaded on S3 storage

Yes.

But you have no error checking here:

my $result = $s3->buckets();

If $result is not defined, which happens when there is an error, you ignore that.

Instead of ignoring that, check the errors there. This is documented in Amazon::S3. Maybe the following helps:

my $result = $s3->buckets(); if( ! $result ) { warn "There was an error when looking at the existing buckets:"; warn join " - ", $s3->err, $s3->errstr; die "Cannot continue."; }; ...

Replies are listed 'Best First'.
Re^6: Need to print bucket and filename which is uploaded on S3 storage
by coolsaurabh (Acolyte) on Aug 21, 2019 at 10:09 UTC
    add_bucket is failing when trying to add the same.
    use Amazon::S3; my $file_name = "filename.txt"; my $bucketName = "forest-upload"; my $s3 = Amazon::S3->new({ aws_access_key_id => "XX", aws_secret_access_key => "XX", retry => 1 }); print $s3; print "\n"; my $result = $s3->buckets(); my $bucket_name = 'Test-Bucket'; my $bucket = $s3->add_bucket( { bucket => $bucket_name } ) or die $s3- +>errstr ;
    Out of this script is Amazon::S3=HASH(0x25dac28) Died at Amazon_bucket.pl line 18.
      Died at Amazon_bucket.pl line 18.

      Your script doesn't have 18 lines therefore the script you have shown is not the script you are running.

        It could be that the script shown didn't have 18 lines of code but if you could have seen the message carefully,you would have got the message what I was trying to convey. my $bucket = $s3->add_bucket( { bucket => $bucket_name } ) or die $s3->errstr ; Above statement is getting failed when run.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11104785]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2020-12-05 09:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (63 votes). Check out past polls.

    Notices?