NAME

Gtk2::CV::Jobber - a job queue mechanism for Gtk2::CV

SYNOPSIS

use Gtk2::CV::Jobber;

DESCRIPTION

%Gtk2::CV::Jobber::job [READ-ONLY]

Global variable containing all jobs, indexed by full path.

Gtk2::CV::Jobber::define $type, [option => $value, ...], $cb

Register a new job type identified by $type. The callback will be called with ($cont, $path, $type), and has to call &$cont once it has finished processing.

pri     => number
read    => whether reading the file contents ahead of time is useful
stat    => whether stating the object ahead of time is useful
fork    => (lots of restrictions)
class   =>
maxread =>
hide    => true if the file(spec) will go away via this job
cb      => callback
Gtk2::CV::Jobber::submit $type, $path, $data

Submit a new job of the given type.

Gtk2::CV::Jobber::disable
Gtk2::CV::Jobber::enable
Gtk2::CV::Jobber::inhibit { ... }

Disable/re-enable execution of background jobs. When disabled, active jobs will finish, but no new jobs will be started until jobs are enabled again. Calls can be nested.

The Gtk2::CV::Jobber::Job class

Layout:

$job->{type}

The job type.

$job->{path}

The full path to the file.

$job->{data}

The original user data passed to add.

$job->{stat}

And arrayref of statdata if stat is requested for given job class.

$job->{fh}
$job->{contents}

The open filehandle to the file and the beginning of the file when reading is requested for the given job class.

Methods:

$job->finish

Has to be called by the callback when the job has finished.

The Gtk2::CV::Jobber::Client class

$self->jobber_register

To be called when creating a new object instance that wants to listen to jobber updates.

$self->jobber_update ($job)

The given job has finished.

AUTHOR

Marc Lehmann <schmorp@schmorp.de>