line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AnyEvent::Net::Amazon::S3::Client; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: An easy-to-use Amazon S3 client with AnyEvent |
4
|
|
|
|
|
|
|
our $VERSION = 'v0.04.0.80'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
2307
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
7
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
44
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
|
|
11
|
use Module::AnyEvent::Helper::Filter -as => __PACKAGE__, -target => 'Net::Amazon::S3::Client', |
10
|
|
|
|
|
|
|
-transformer => 'Net::Amazon::S3', |
11
|
|
|
|
|
|
|
-translate_func => [qw(@buckets create_bucket _send_request_raw _send_request _send_request_content _send_request_xpc)], |
12
|
|
|
|
|
|
|
-replace_func => [qw(_create request)] |
13
|
1
|
|
|
1
|
|
4
|
; |
|
1
|
|
|
|
|
2
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
1; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
__END__ |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=pod |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=encoding UTF-8 |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 NAME |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
AnyEvent::Net::Amazon::S3::Client - An easy-to-use Amazon S3 client with AnyEvent |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 VERSION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
version v0.04.0.80 |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 SYNOPSIS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $s3 = AnyEvent::Net::Amazon::S3->new( |
34
|
|
|
|
|
|
|
aws_access_key_id => $aws_access_key_id, |
35
|
|
|
|
|
|
|
aws_secret_access_key => $aws_secret_access_key, |
36
|
|
|
|
|
|
|
retry => 1, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
my $client = AnyEvent::Net::Amazon::S3::Client->new( s3 => $s3 ); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# list all my buckets |
41
|
|
|
|
|
|
|
# returns a list of L<AnyEvent::Net::Amazon::S3::Client::Bucket> objects |
42
|
|
|
|
|
|
|
my @buckets = $client->buckets; |
43
|
|
|
|
|
|
|
foreach my $bucket (@buckets) { |
44
|
|
|
|
|
|
|
print $bucket->name . "\n"; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# create a new bucket |
48
|
|
|
|
|
|
|
# returns a L<AnyEvent::Net::Amazon::S3::Client::Bucket> object |
49
|
|
|
|
|
|
|
my $bucket = $client->create_bucket( |
50
|
|
|
|
|
|
|
name => $bucket_name, |
51
|
|
|
|
|
|
|
acl_short => 'private', |
52
|
|
|
|
|
|
|
location_constraint => 'US', |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# or use an existing bucket |
56
|
|
|
|
|
|
|
# returns a L<AnyEvent::Net::Amazon::S3::Client::Bucket> object |
57
|
|
|
|
|
|
|
my $bucket = $client->bucket( name => $bucket_name ); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 DESCRIPTION |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This module provides the same interface as L<Net::Amazon::S3::Client>. |
62
|
|
|
|
|
|
|
In addition, some asynchronous methods returning AnyEvent condition variable are added. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
WARNING: Original L<Net::Amazon::S3::Client> says that it is an early release of the Client classes, the APIs |
65
|
|
|
|
|
|
|
may change. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=for test_synopsis no strict 'vars'; |
68
|
|
|
|
|
|
|
no warnings; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 METHODS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
All L<Net::Amazon::S3::Client> methods are available. |
73
|
|
|
|
|
|
|
In addition, there are the following asynchronous methods. |
74
|
|
|
|
|
|
|
Arguments of the methods are identical as original but return value becomes L<AnyEvent> condition variable. |
75
|
|
|
|
|
|
|
You can get actual return value by calling C<shift-E<gt>recv()>. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=over 4 |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item buckets_async |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item create_bucket_async |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=back |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=for Pod::Coverage bucket bucket_class |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 SEE ALSO |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=over 4 |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item * |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
L<AnyEvent::Net::Amazon::S3> |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item * |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
L<Net::Amazaon::S3::Client> - Based on it as original. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item * |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
L<Module::AnyEvent::Helper> - Used by this module. There are some description for needs of _async methods. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=back |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 AUTHOR |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Yasutaka ATARASHI <yakex@cpan.org> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
This software is copyright (c) 2012 by Yasutaka ATARASHI. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
114
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |