簡體   English   中英

Rackspace Cloud API的Perl綁定和設置/獲取對象元數據的問題

[英]Issues with the Perl binding of the Rackspace Cloud API and setting/getting object metadata

使用Rackspace Cloud API [ Github ]的非官方Perl綁定 ,我不能為我的生活設置或檢索給定對象的元數據。

我可以成功地從雲端下載文件,但是當我按照文檔中的定義調​​用object_metadata ,我會收到一個抱怨uninitialized value的錯誤。 我可以通過Cloud Files管理器驗證是否在元數據中為Status設置了值。 我甚至嘗試檢查X-Object-Meta-Status (沒有成功)。

相關代碼如下:

# 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 });

}

就像我說的,對象被成功檢索,我只是無法查看給定文件上的元數據。 我已經玩過上面的一些變化,但是每種新方法的測試都會花費帶寬(金錢!)。 任何幫助將非常感謝!

我覺得根本沒有設置元數據。 我們來看看使用Moose構建的WebService :: Rackspace :: CloudFiles :: Object

has 'object_metadata' => (
    is => 'rw',
    isa => 'HashRef',
    required => 0,
    default => sub {
        return {};
    }
);

所以有一個可選的屬性object_metadata ,可以使用內置選擇器檢索它。 大!

$container->objects返回的$container->objects是在WebService :: Rackspace :: CloudFiles :: Container中創建的( 剪切 ):

foreach my $bit (@bits) {
  push @objects,
    WebService::Rackspace::CloudFiles::Object->new(
    cloudfiles => $self->cloudfiles,
    container => $self,
    name => $bit->{name},
    etag => $bit->{hash},
    size => $bit->{bytes},
    content_type => $bit->{content_type},
    last_modified => $bit->{last_modified},
  );
}

因此,如果我正確地看到這一點,則此調用中沒有object_metadata屬性,這很好,因為它是可選的。 但是如果它沒有設置,你檢索一個空的hashref是否有意義,不是嗎?

我想你可能想要自己補丁一下。 : - /


我做了一些挖掘:在CloudFiles文檔中,它表示元數據在結果的HTTP標頭中返回。 關於如何自行檢索元數據文檔很好地解釋了它是如何傳輸的。 但不幸的是,在模塊中肯定沒有解析。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM