1 package TAP::Parser::Scheduler::Job;
9 TAP::Parser::Scheduler::Job - A single testing job.
21 use TAP::Parser::Scheduler::Job;
25 Represents a single test 'job'.
33 my $job = TAP::Parser::Scheduler::Job->new(
37 Returns a new C<TAP::Parser::Scheduler::Job> object.
42 my ( $class, $name, $desc, @ctx ) = @_;
46 @ctx ? ( context => \@ctx ) : (),
52 Register a closure to be called when this job is destroyed.
57 my ( $self, $cb ) = @_;
58 $self->{on_finish} = $cb;
63 Called when a job is complete to unlock it.
69 if ( my $cb = $self->{on_finish} ) {
82 sub filename { shift->{filename} }
83 sub description { shift->{description} }
84 sub context { @{ shift->{context} || [] } }
86 =head3 C<as_array_ref>
88 For backwards compatibility in callbacks.
94 return [ $self->filename, $self->description, $self->{context} ||= [] ];
99 Returns false indicating that this is a real job rather than a
100 'spinner'. Spinners are returned when the scheduler still has pending
101 jobs but can't (because of locking) return one right now.