Using the unofficial Perl binding of the Rackspace Cloud API [Github], I can’t for the life of me set or retrieve the metadata of a given object.
I can successfully pull files down from the cloud, but when I call object_metadata as defined in the documentation I get an error complaining about uninitialized value. I can verify through the Cloud Files manager that a value is set for Status in the metadata. I’ve even tried checking for X-Object-Meta-Status (with no success).
Relevant code is as follows:
# authentication
# set $container to pre-made container
my @files = $container->objects(prefix => 'tainted/')->all;
FILE: foreach my $file(@files) {
# throws undefined // have tried capitalized and not, quotes and none
next FILE if $file->object_metadata->{'status'} != '-1';
# download file from object & do stuff with it
# does not update object in cloud (not sure if anything id done locally)
$file->object_metadata({ status => $status });
}
Like I said, objects are successfully being retrieved, I just am not able to view meta on a given file. I’ve played with some variations of what is above, but each test of a new approach costs bandwidth (money!). Any help would be very much appreciated!
I’ve got the feeling that the metadata is not being set at all. Let’s take a look at WebService::Rackspace::CloudFiles::Object, which is built using Moose:
So there’s an optional property
object_metadata, which can be retrieved using the built-in selector. Great!The objects that are being returned by
$container->objectsare created in WebService::Rackspace::CloudFiles::Container like this (snipped):So if I see this correctly, there’s no
object_metadataproperty in this call, which is fine because it’s optional. But if it’s not set, it makes sense that you retrieve an empty hashref, doesn’t it?I’d say you might want to patch that in yourself. :-/
I did a little more digging: In the CloudFiles docs it says that the metadata is returned in the HTTP header of the result. The docs on how to retrieve metadata on its own gives a good explanation of how it is transmitted. But unfortunately, there is no parsing going on for that in the module for sure.