Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Data::Queue::Persistence experience

by SimonClinch (Deacon)
on May 13, 2011 at 16:39 UTC ( #904697=note: print w/replies, xml ) Need Help??


in reply to Data::Queue::Persistence experience

If o/s supports fifos, then they are better than using a database, e.g.
package persque; sub new { bless { FIFO => shift()}; # must be given an existent fifo file or + creatable filename } sub install { # create persistent queue my $self = shift; mkfifo $self -> { FIFO } or die "$!: " . $self -> { FIFO } . "\n"; } sub enqueue { my $self = shift; my @items = @_; chomp @items; open $fh, '>' . $self -> { FIFO } or die "$!: " . $self -> { FIFO } . "\n"; print $fh (map { $_ . "\n" } @_); close $fh; } sub dequeue { my $self = shift; open $fh, $self -> { FIFO } or die "$!: " . $self -> { FIFO } . "\n"; my $r = <$fh>; close $fh; $r; } 1;

One world, one people

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://904697]
help
Chatterbox?
[shmem]: but the results of both operations are different.
[shmem]: result := the discarded result (what's leftmost of the statement)
[shmem]: push returns the number of elements in @foo, the assignment returns all the elements in the (renewed) @foo
[Lady_Aleena]: Sanity check please? push @line, ref($list_addition ) eq 'ARRAY' ? @$list_addition : $list_addiction; # so I don't have the change existing uses of the sub.
[shmem]: $list_addiction should be $list_addition
Discipulus loose the tozzetto party!
[shmem]: .oO( addition of cookies for addiction to cookies )
[Lady_Aleena]: Other than my typos shmem. 8)

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2017-04-27 11:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (503 votes). Check out past polls.