package Queue;
use strict;
sub new
{
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
($self->{dir}) = @_;
bless ($self, $class);
return $self;
}
sub get_dir { my $self = shift; return $self->{dir} }
sub new_tag
{
my $self = shift;
return $self->{dir} . "/" . time . "-" . int(rand(100000));
}
sub next
{
my $self = shift;
return glob($self->{dir} . "/*");
}
sub next_by_ext
{
my $self = shift;
my $ext = shift;
return glob($self->{dir} . "/*" . $ext);
}
sub dequeue
{
my $self = shift;
my $filename = shift;
return unlink $filename;
}
1;
In reply to Queue.pm
by vxp