-
Notifications
You must be signed in to change notification settings - Fork 2
/
play.pl
executable file
·37 lines (29 loc) · 859 Bytes
/
play.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/home/acme/perl-5.10.0/bin//perl
use strict;
use warnings;
use lib 'lib';
use Net::Cassandra;
use Perl6::Say;
my $cassandra = Net::Cassandra->new;
my $client = $cassandra->client;
my $key = '123';
my $timestamp = time;
eval {
$client->insert( 'Table1', $key, 'Standard1:name', 'Leon Brocard',
$timestamp, 0 );
};
die $@->why if $@;
eval {
$client->remove( 'Table1', $key, 'Standard1:age', $timestamp );
};
die $@->why if $@;
my $column;
eval { $column = $client->get_column( 'Table1', $key, 'Standard1:name' ); };
die $@->why if $@;
say $column->{columnName}, ', ', $column->{value}, ', ', $column->{timestamp};
my $slice;
eval { $slice = $client->get_slice( 'Table1', $key, 'Standard1', -1, -1 ); };
die $@->why if $@;
foreach my $row (@$slice) {
say $row->{columnName}, ', ', $row->{timestamp}, ', ', $row->{value};
}