2010-03-21 54 views
3

當使用Perl模塊,Net::Cassandra::Easy接口與卡桑德拉我用下面的代碼在列家族Standard1來讀取行row[123] colums col[123]爲什麼在使用Net :: Cassandra :: Easy和Cassandra 0.5x插入行時出現錯誤?

my $cassandra = Net::Cassandra::Easy->new(keyspace => 'Keyspace1', server => 'localhost'); 
$cassandra->connect(); 
my $result = $cassandra->get(['row1', 'row2', 'row3'], family => 'Standard1', byname => ['col1', 'col2', 'col3']); 

可正常工作。

然而,試圖插入一行row1用..

$result = $cassandra->mutate(['row1'], family => 'Standard1', insertions => { "col1" => "Value to set." }); 

的時候..我收到錯誤消息Can't use string ("0") as a SCALAR ref while "strict refs" in use at .../Net/GenThrift/Thrift/BinaryProtocol.pm line 376

我在做什麼錯?

回答

3

代碼工作。在卡桑德拉0.6.x如預期,但卡桑德拉下失敗0.5.x.

看起來好像Net::Cassandra::Easy瞄準卡桑德拉0.6.x只。

升級到Cassandra 0.6.x可解決問題。

3

它看起來像在圖書館中的錯誤:

sub readByte 
{ 
    my $self = shift; 
    my $value = shift; 

    my $data = $self->{trans}->readAll(1); 
    my @arr = unpack('c', $data); 
    $$value = $arr[0]; # <~ line 376 
    return 1; 
} 

(從Net::GenThrift::Thrift::BinaryProtocol)

Apparently that sub is being called from somewhere in the library where $value不是一個變量,而是一個常數標我的bug報告的作者

+0

嗨!感謝您的回答。二進制協議似乎已經在0.5和0.6之間變化,其中Net :: Cassandra :: Easy似乎只針對0.6。 – knorv 2010-03-22 17:37:07

1

嗯,它看起來更像是一個處理異常給我的Perl綁定錯誤。

我相信0.6會爲你修復它,因爲接口確實已經改變了,所以0.6不再提高節儉異常,但是節儉中的bug仍然存在。我已經開了一個JIRA情況下,我們會看到節儉的團隊說的只是:

https://issues.apache.org/jira/browse/THRIFT-758