Next Lightweight Databases 89

Sequential Access

        my $db = tied %hash;
        my ($k, $v, $fail);
        for ($fail = $db->seq($k, $v, R_FIRST) ;
                 ! $fail ;
                 $fail = $db->seq($k, $v, R_NEXT)
            ) {
          print "$k => $v\n";
        }
        for ($fail = $db->seq($k, $v, R_LAST);
                 ! $fail;
                 $fail = $db->seq($k, $v, R_PREV)
            ) {
          print "$k => $v\n";
        }
        $k = $a;
        for ($fail = $db->seq($k, $v, R_CURSOR);
                 ! $fail && $k le $b;
                 $fail = $db->seq($k, $v, R_NEXT)
            ) {
          print "$k => $v\n";
        }


Next Copyright © 2003 M. J. Dominus