Backblaze-B2
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
'PREREQ_PM' => {
'Carp' => '0',
'Data::Dumper' => '0',
'MIME::Base64' => '0',
'JSON::XS' => '0',
'URI::QueryParam' => '0',
'Promises' => '0',
'AnyEvent' => '0',
'AnyEvent::HTTP' => '0',
'URI' => '0',
'Scalar::Util' => '0', # for &weaken
'File::HomeDir' => '0', # so we can load the defailt API keys
}, # e.g., Module::Name => 1.1
ABSTRACT_FROM => $module_pm, # retrieve abstract from module
AUTHOR => 'Max Maischein <corion@cpan.org>',
test => { TESTS => join( ' ', @tests ) },
);
1;
lib/Backblaze/B2.pm view on Meta::CPAN
Returns the underlying API object
=cut
sub api { $_[0]->{api} }
1;
package Backblaze::B2::v1::Bucket;
use strict;
use Scalar::Util 'weaken';
sub new {
my( $class, %options ) = @_;
weaken $options{ parent };
# Whoa! We assume that the async version has the same class name
# as the synchronous version and just strip it off.
$options{ file_class } =~ s!::Synchronized$!!;
bless \%options => $class,
}
sub name { $_[0]->{bucketName} }
#sub api { $_[0]->{api} }
lib/Backblaze/B2.pm view on Meta::CPAN
=head2 C<< ->api >>
Returns the underlying API object
=cut
sub api { $_[0]->{api} }
package Backblaze::B2::v1::File;
use strict;
#use Scalar::Util 'weaken'; # do we really want to weaken our link?!
# The bucket doesn't hold a ref to us, so we don't want to weaken it
sub new {
my( $class, %options ) = @_;
#weaken $options{ bucket };
#warn "$class: " . join ",", sort keys %options;
bless \%options => $class,
}
sub name { $_[0]->{fileName} }
sub id { $_[0]->{fileId} }
sub action { $_[0]->{action} }
sub bucket { $_[0]->{bucket} }
sub size { $_[0]->{size} }
sub downloadUrl { join "/", $_[0]->bucket->downloadUrl, $_[0]->name }
package Backblaze::B2::v1::File::Synchronized;
use strict;
use Carp qw(croak);
#use Scalar::Util 'weaken'; # do we really want to weaken our link?!
# The bucket doesn't hold a ref to us, so we don't want to weaken it
sub new {
my( $class, %options ) = @_;
#weaken $options{ bucket };
#warn "$class: " . join ",", sort keys %options;
croak "Need impl" unless $options{ impl };
bless \%options => $class,
}
sub name { $_[0]->{impl}->name }
sub id { $_[0]->{impl}->id }
sub action { $_[0]->{impl}->action }
sub bucket { $_[0]->{impl}->bucket }
( run in 0.266 second using v1.01-cache-2.11-cpan-65fba6d93b7 )