1Net::Amazon::S3::ClientU:s:eOrbjCeocntt(r3i)buted Perl DNoectu:m:eAnmtaaztoino:n:S3::Client::Object(3)
2
3
4
6 Net::Amazon::S3::Client::Object - An easy-to-use Amazon S3 client
7 object
8
10 # show the key
11 print $object->key . "\n";
12
13 # show the etag of an existing object (if fetched by listing
14 # a bucket)
15 print $object->etag . "\n";
16
17 # show the size of an existing object (if fetched by listing
18 # a bucket)
19 print $object->size . "\n";
20
21 # to create a new object
22 my $object = $bucket->object( key => 'this is the key' );
23 $object->put('this is the value');
24
25 # to get the vaue of an object
26 my $value = $object->get;
27
28 # to see if an object exists
29 if ($object->exists) { ... }
30
31 # to delete an object
32 $object->delete;
33
34 # to create a new object which is publically-accessible with a
35 # content-type of text/plain which expires on 2010-01-02
36 my $object = $bucket->object(
37 key => 'this is the public key',
38 acl_short => 'public-read',
39 content_type => 'text/plain',
40 expires => '2010-01-02',
41 );
42 $object->put('this is the public value');
43
44 # return the URI of a publically-accessible object
45 my $uri = $object->uri;
46
47 # upload a file
48 my $object = $bucket->object(
49 key => 'images/my_hat.jpg',
50 content_type => 'image/jpeg',
51 );
52 $object->put_filename('hat.jpg');
53
54 # upload a file if you already know its md5_hex and size
55 my $object = $bucket->object(
56 key => 'images/my_hat.jpg',
57 content_type => 'image/jpeg',
58 etag => $md5_hex,
59 size => $size,
60 );
61 $object->put_filename('hat.jpg');
62
63 # download the value of the object into a file
64 my $object = $bucket->object( key => 'images/my_hat.jpg' );
65 $object->get_filename('hat_backup.jpg');
66
67 # use query string authentication
68 my $object = $bucket->object(
69 key => 'images/my_hat.jpg',
70 expires => '2009-03-01',
71 );
72 my $uri = $object->query_string_authentication_uri();
73
75 This module represents objects in buckets.
76
78 etag
79 # show the etag of an existing object (if fetched by listing
80 # a bucket)
81 print $object->etag . "\n";
82
83 delete
84 # to delete an object
85 $object->delete;
86
87 exists
88 # to see if an object exists
89 if ($object->exists) { ... }
90
91 get
92 # to get the vaue of an object
93 my $value = $object->get;
94
95 get_filename
96 # download the value of the object into a file
97 my $object = $bucket->object( key => 'images/my_hat.jpg' );
98 $object->get_filename('hat_backup.jpg');
99
100 key
101 # show the key
102 print $object->key . "\n";
103
104 put
105 # to create a new object
106 my $object = $bucket->object( key => 'this is the key' );
107 $object->put('this is the value');
108
109 # to create a new object which is publically-accessible with a
110 # content-type of text/plain
111 my $object = $bucket->object(
112 key => 'this is the public key',
113 acl_short => 'public-read',
114 content_type => 'text/plain',
115 );
116 $object->put('this is the public value');
117
118 You may also set Content-Encoding using content_encoding.
119
120 put_filename
121 # upload a file
122 my $object = $bucket->object(
123 key => 'images/my_hat.jpg',
124 content_type => 'image/jpeg',
125 );
126 $object->put_filename('hat.jpg');
127
128 # upload a file if you already know its md5_hex and size
129 my $object = $bucket->object(
130 key => 'images/my_hat.jpg',
131 content_type => 'image/jpeg',
132 etag => $md5_hex,
133 size => $size,
134 );
135 $object->put_filename('hat.jpg');
136
137 You may also set Content-Encoding using content_encoding.
138
139 query_string_authentication_uri
140 # use query string authentication
141 my $object = $bucket->object(
142 key => 'images/my_hat.jpg',
143 expires => '2009-03-01',
144 );
145 my $uri = $object->query_string_authentication_uri();
146
147 size
148 # show the size of an existing object (if fetched by listing
149 # a bucket)
150 print $object->size . "\n";
151
152 uri
153 # return the URI of a publically-accessible object
154 my $uri = $object->uri;
155
156
157
158perl v5.12.3 2010-03-30Net::Amazon::S3::Client::Object(3)