Skip to content

Instantly share code, notes, and snippets.

@gslin
Created November 9, 2010 12:58
Show Gist options
  • Save gslin/669047 to your computer and use it in GitHub Desktop.
Save gslin/669047 to your computer and use it in GitHub Desktop.
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