perl - 为什么在使用 Net::Cassandra::Easy 和 Cassandra 0.5x 插入行时出现错误?

标签 perl nosql cassandra thrift

使用 Perl 模块时 Net::Cassandra::Easy为了与 Cassandra 交互,我使用以下代码从列族 Standard1 中的行 row[123] 读取列 col[123]:

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

我做错了什么?

最佳答案

它看起来像是库中的错误:

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

(来自 <a href="http://cpansearch.perl.org/src/TEODOR/Net-Cassandra-Easy-0.05/lib/Net/GenThrift/Thrift/BinaryProtocol.pm" rel="noreferrer noopener nofollow">Net::GenThrift::Thrift::BinaryProtocol</a>)

显然,sub 是从库中的某处调用的,其中 $value不是变量,而是常量标量。我会向作者报告错误。

关于perl - 为什么在使用 Net::Cassandra::Easy 和 Cassandra 0.5x 插入行时出现错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2488783/

相关文章:

linux - 以编程方式加载 Cassandra 架构

perl - 使用Perl按点分割

perl - 在 Raku 中使用 Perl 5 模块 Data::Printer 的 `show_tied` 选项时,如何关闭它?

nosql - (非关系型)DBMS 设计资源

database - CouchBase 1.8 和 2.0 Erlang SDK?为什么 Erlang 被排除在外

java - apache-cassandra 0.8.2 的问题

cassandra - 是否可以使用cql连续查询集合?

java - 无法测试 Cassandra executeAsync 响应

perl - 获取数组的实际值

bash - 使用 Perl 的列过滤器表达式的正确联机程序是什么?