Permalink
Browse files

add more examples

  • Loading branch information...
1 parent 379066b commit 5fee6e8ca32c9df2cc9a0d5ac9c10ad333c7833e @acme committed Jul 10, 2009
Showing with 25 additions and 4 deletions.
  1. +25 −4 play.pl
View
29 play.pl
@@ -3,14 +3,35 @@
use warnings;
use lib 'lib';
use Net::Cassandra;
+use Perl6::Say;
my $cassandra = Net::Cassandra->new;
my $client = $cassandra->client;
-my $key_user_id = '3141';
-my $timestamp = time;
+my $key = '123';
+my $timestamp = time;
+
+eval {
+ $client->insert( 'Table1', $key, 'Standard1:name', 'Leon Brocard',
+ $timestamp, 0 );
+};
+die $@->why if $@;
+
eval {
- $client->insert( 'Table1', $key_user_id, 'Standard1:name', 'Leon Brocard',
- $timestamp );
+
+ $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};
+}

0 comments on commit 5fee6e8

Please sign in to comment.