Tie::Queue

Tie an ARRAY over a TokyTyrant DB
Download

Tie::Queue Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • Dulaunoy Fabrice
  • Publisher web site:
  • http://search.cpan.org/~fdulau/Tie-CountLoop-1.5/lib/Tie/CountLoop.pm

Tie::Queue Tags


Tie::Queue Description

Tie an ARRAY over a TokyTyrant DB Tie an ARRAY over a TokyTyrant DB and allow to push, pop shift data. Tie::Queue requires TokyoTyrant (database and Perl module.) If the serialisation is required, the module Data::Serilizer is also required The normal ARRAY function present are push pop shift exists scalar storesize ( to allow undef @a) Specific function CLEAR SYNC REPAIR The following function are not implemented. EXTEND STORE DELETE SPLICESYNOPSIS use Tie::Queue; use Data::Dumper; ## Queue creation # This queue is not re-initialised at each execution of the script # the default namespace is 'Tie-Queue' # and each item are non serialized tie my @a, 'Tie::Queue', '127.0.0.1', 1978, 0; # This queue is NOT re-initialised at each execution of the script # and each item are non serialized # the namespace is 'second_queue' tie my @b, 'Tie::Queue', '127.0.0.1', 1978, 1 , 0 , 'second_queue'; ## put some data in the queue for ( 101 .. 110 ) { push @a, $_; } for ( 1001 .. 1005 ) { push @ab, $_; } push @b, 'some text'; push ## show the content of the queue print Dumper( @a ); ## print the size of the queue print "size of array=". scalar @a. " "; ## remove the latest pushed element from the queue ( the newest) $res1 = pop @a; print "latest element $res1 "; print "size of array=". scalar @a. " "; print Dumper( @a ); $res2 = $a; print "element 3 = $res2 "; ## remove the first element from the queue ( the oldest ) $res3 = shift @a; print "first element $res3 "; print "size of array=". scalar @a. " "; print Dumper( @a ); if ( exists $a ) { print "elem 4 exists "; } else { print "elem 4 NOT exists "; } if ( exists $a ) { print "elem 40 exists "; } else { print "elem 40 is NOT existing "; } (tied @a)->CLEAR; print "size of array=". scalar @a. " "; ######################## # this queue is re-initialised at each execution of the script # and each item are serialized # and the name space is 'third_queue_serialized' tie my @c, 'Tie::Queue', '127.0.0.1', 1978, 1 , 1 , 'third_queue_serialized'; my %test = ( a => 'key_a', b => 'key_B' , c => 3 ); print Dumper(\%test); push @d , \%test; my $r = pop @d; print Dumper($r) ####################### Requirements: · Perl


Tie::Queue Related Software