LMPX.COM |
Home | Linux | Mysql | PHP | XML | ||
|
|
|||
From: Thomas J Pinkl Date: Mon Mar 5 09:28:03 2007 Subject: Re: usage question
On Mon, Mar 05, 2007 at 11:24:07AM +0000, Justin Mason wrote: > Alternatively, I'd be happy to apply a patch that implements > a version of visit_all_jobs() which allows writes somehow, or > a way to access a job returned by visit_all_jobs() and render > it writable. Justin, here's a patch which adds an optional "readonly" parameter to visit_all_jobs(). If the parameter isn't passed, then it defaults to true, thus maintaining backward compatibility. The patch includes changes to the POD as well. It's against the current SVN source. -- Thomas J. Pinkl | T: 215-442-9300 Senior Systems Architect | 800-444-1427 Health Business Systems, Inc | F: 215-442-7555 An SXC Company | 738 Louis Drive | http://www.hbsrx.com/ Warminster, PA 18974 | http://www.sxc.com/ --- DirQueue.pm.orig 2007-03-03 11:06:33.000000000 -0500 +++ DirQueue.pm 2007-03-05 11:19:08.000000000 -0500 @@ -708,10 +708,9 @@ ########################################################################### -=item $job = $dq->visit_all_jobs($visitor, $visitcontext); +=item $job = $dq->visit_all_jobs($visitor, $visitcontext, $readonly); -Visit all the jobs in the queue, in a read-only mode. Used to list -the entire queue. +Visit all the jobs in the queue. Used to list the entire queue. The callback function C<$visitor> will be called for each job in the queue, like so: @@ -720,7 +719,8 @@ C<$visitcontext> is whatever you pass in that variable above. C<$job> is a new, read-only instance of C<IPC::DirQueue::Job> representing -that job. +that job. C<$readonly> is an optional boolean flag and defaults to true +if not passed. If a job is active (being processed), the C<$job> object also contains the following additional data: @@ -731,7 +731,10 @@ =cut sub visit_all_jobs { - my ($self, $visitor, $visitcontext) = @_; + my ($self, $visitor, $visitcontext, $readonly) = @_; + + $readonly = 1 if (! defined $readonly); + $readonly = 1 if ($readonly != 0); my $pathqueuedir = $self->q_subdir('queue'); my $pathactivedir = $self->q_subdir('active'); @@ -764,7 +767,7 @@ } my $job = IPC::DirQueue::Job->new ($self, { - is_readonly => 1, # means finish() will not rm files + is_readonly => $readonly, # if true, means finish() will not rm files jobid => $nextfilebase, active_host => $acthost, active_pid => $actpid,
| Navigate in group perl.ipc.dirqueue at sever nntp.perl.org | |
| Previous | Next |
| © No Copyright You are free to use Anything |
Site Maintained by PHP Developer
Powered By PHP Consultants |