#!/usr/pkg/bin/perl -w
=head1 NAME

dq-submit - submit tasks to an IPC::DirQueue queue

=head1 SYNOPSIS

B<dq-submit> --dir I<qdirectory> I<file ...>

=head1 DESCRIPTION

B<dq-submit> will submit tasks to an C<IPC::DirQueue> directory.
Multiple task files can be specified on the command-line.

=head1 SEE ALSO

IPC::DirQueue(3)
dq-deque(1)
dq-list(1)
dq-server(1)
dq-submit(1)

=cut

use strict;
use lib 'lib';
use IPC::DirQueue;
use Getopt::Long;

sub usage {
  die "usage: dq-submit --dir qdirectory file [file2 ...]\n";
}

our $dir;

GetOptions(
  'dir=s'   => \$dir
) or usage();
$dir or usage();

my $dq = IPC::DirQueue->new({ dir => $dir });

foreach my $file (@ARGV) {
  $dq->enqueue_file($file);
  print "enqueued: $file\n";
}

