my ($pid, $call, $assoc_obj) = @_;
my $job = new Psh
::Job
( $pid, $call, $assoc_obj);
my $job= $jobs_list{$pid};
return if !defined($job);
for($i=0; $i <= $#jobs_order; $i++) {
last if( $jobs_order[$i]==$job);
splice( @jobs_order, $i, 1);
return exists($jobs_list{$pid});
for( my $i=0; $i<=$#jobs_order; $i++) {
return $i+1 if( $jobs_order[$i]->{pid
}==$pid);
# $pid=Psh::Joblist::find_job([$jobnumber])
# Finds either the job with the specified job number
# or the highest numbered not running job and returns
# the job or undef is none is found
return $jobs_order[$job_to_start] if defined( $job_to_start);
for (my $i = $#jobs_order; $i >= 0; $i--) {
my $job = $jobs_order[$i];
return wantarray?
($i,$job):$job;
sub find_last_with_name
{
my ($name, $runningflag) = @_;
while( my $job= Psh
::Joblist
::each()) {
next if $runningflag && $job->{running
};
if ($call=~ m
:([^/\s
]+)\s
*: ) {
} elsif( $call=~ m
:/([^/\s
]+)\s
+.*$: ) {
} elsif ( $call=~ m
:^([^/\s
]+): ) {
return wantarray?
($index,$job->{pid
},$job->{call
}):$index;
return wantarray?
():undef;
# Resets the enumeration counter for access using "each"
if ($pointer <= $#jobs_order) {
return $jobs_order[$pointer++];
# $job= new Psh::Job( pid, call);
# Creates a new Job object
# pid is the pid of the object
# call is the name of the executed command
my ( $class, $pid, $call, $assoc_obj ) = @_;
$self->{assoc_obj
}=$assoc_obj;
# Sends SIGCONT to the job and records it running
# minus sign to wake up the whole group of the child:
if( Psh
::OS
::has_job_control
()) {
Psh
::OS
::resume_job
($self);
Psh::Joblist - A data structure suitable for handling job lists like bash's
$job = Psh::Joblist::create_job($pid,$displayed_command);
Psh::Joblist::delete_job($pid);
$job = Psh::Joblist::get_job($pid);
$flag = Psh::Joblist::job_exists($pid);
$index = Psh::Joblist::get_job_number($pid);
$job = Psh::Joblist::find_job();
$job = Psh::Joblist::find_job($index);
Psh::Joblist::enumerate();
while( $job= Psh::Joblist::each()) { ... }
Markus Peter (warp@spin.de)