Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Data::Queue::Persistence experience

by SimonClinch (Chaplain)
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


Comment on Re: Data::Queue::Persistence experience
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://904697]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2015-07-30 00:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls