Created
November 9, 2010 12:58
-
-
Save gslin/669047 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package JobQueue; | |
use strict; | |
use warnings; | |
sub get | |
{ | |
my $self = shift; | |
shift @{$self->{jqa}}; | |
} | |
sub new | |
{ | |
bless {jq => {}, jqa => []}; | |
} | |
sub put | |
{ | |
my $self = shift; | |
my $id = shift; | |
return if defined $self->{jq}->{$id}; | |
$self->{jq}->{$id} = 0; | |
push @{$self->{jqa}}, $id; | |
} | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment