Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2017-02-19 13:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (292 votes). Check out past polls.