Permalink
Browse files

more kiokupipe testing

  • Loading branch information...
1 parent c2ee2a2 commit 197270ec434504eb0d8517664f021c768c960331 hakim committed Jul 13, 2010
Showing with 20 additions and 6 deletions.
  1. +4 −0 scratch/perl/kiokupipe/lib/List/Map.pm
  2. +16 −6 scratch/perl/kiokupipe/test.pl
@@ -12,14 +12,18 @@ has '+head' => (
lazy => 1,
default => sub {
my $self = shift;
+ my $val = $self->list->head;
+ warn "Called with $val";
$self->transform( $self->list->head ),
},
);
has '+tail' => (
+ traits => ['KiokuDB::Lazy'],
lazy => 1,
default => sub {
my $self = shift;
+ warn "Making tail";
my $class = (ref $self) || $self;
if (my $tail = $self->list->tail) {
return $class->new( list => $tail );
@@ -1,19 +1,29 @@
#!/usr/bin/perl
+use strict; use warnings;
use List;
use List::Map::Increment;
use Data::Dumper;
-my $list = List->from_array(1..10);
+use KiokuDB;
+my $list = List->from_array(1..10);
my $map = List::Map::Increment->new( list => $list );
local $Data::Dumper::Indent = 1;
-local $Data::Dumper::Maxdepth = 4;
-warn Dumper($list, $map);
+local $Data::Dumper::Maxdepth = 10;
+
+{
+ my $kioku = KiokuDB->connect('hash');
+ my $scope = $kioku->new_scope;
-while ($map) {
warn $map->head;
- $map = $map->tail;
-}
+ warn $map->tail->head;
+ warn $map->tail->tail->head;
+ $kioku->store(map => $map);
+
+ my $map2 = $kioku->lookup('map');
+
+ warn Dumper($map2);
+}

0 comments on commit 197270e

Please sign in to comment.