Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / site_perl / 5.8.0 / Psh / Strategy / Auto_resume.pm
CommitLineData
86530b38
AT
1package Psh::Strategy::Auto_resume;
2
3=item * C<auto_resume>
4
5If the input line matches the name of a stopped job
6then brings that job to the foreground instead of starting
7a new program with that name
8
9=cut
10
11require Psh::Strategy;
12require Psh::Joblist;
13
14@Psh::Strategy::Auto_resume::ISA=('Psh::Strategy');
15
16sub new { Psh::Strategy::new(@_) }
17
18sub consumes {
19 return Psh::Strategy::CONSUME_TOKENS;
20}
21
22sub applies {
23 my $fnname= ${$_[2]}[0];
24 if( my($index, $pid, $call)=
25 Psh::Joblist::find_last_with_name($fnname,1))
26 {
27 return "auto-resume $call";
28 }
29 return '';
30}
31
32sub execute {
33 my $fnname= ${$_[2]}[0];
34 my ($index)= Psh::Joblist::find_last_with_name($fnname,1);
35 Psh::OS::restart_job(1,$index);
36 return (1,undef);
37}
38
39sub runs_before {
40 return qw(perlscript executable);
41}
42
431;