/[cvs]/nfo/perl/libs/Data/Rap/Engine.pm
ViewVC logotype

Diff of /nfo/perl/libs/Data/Rap/Engine.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by joko, Sat Feb 22 16:51:21 2003 UTC revision 1.7 by joko, Fri Mar 28 07:02:56 2003 UTC
# Line 2  Line 2 
2  ##  $Id$  ##  $Id$
3  ## ----------------------------------------------------------------------  ## ----------------------------------------------------------------------
4  ##  $Log$  ##  $Log$
5    ##  Revision 1.7  2003/03/28 07:02:56  joko
6    ##  modified structure around '$wrapper_program'
7    ##
8    ##  Revision 1.6  2003/03/27 15:31:05  joko
9    ##  fixes to modules regarding new namespace(s) below Data::Mungle::*
10    ##
11    ##  Revision 1.5  2003/03/27 15:03:03  joko
12    ##  enhanced 'sub run_executable'
13    ##
14  ##  Revision 1.4  2003/02/22 16:51:21  joko  ##  Revision 1.4  2003/02/22 16:51:21  joko
15  ##  + enhanced run_executable  ##  + enhanced run_executable
16  ##  modified logging output  ##  modified logging output
# Line 31  use Hash::Merge qw( merge ); Line 40  use Hash::Merge qw( merge );
40  use Iterate;  use Iterate;
41    
42  use shortcuts qw( run_cmd );  use shortcuts qw( run_cmd );
43  use Data::Code::Ref qw( ref_slot );  use Data::Mungle::Code::Ref qw( ref_slot );
44  use Data::Transform::Deep qw( expand );  use Data::Mungle::Transform::Deep qw( expand );
45    
46    
47  sub performTarget {  sub performTarget {
# Line 296  sub run_executable { Line 305  sub run_executable {
305      my $program = $opts->{executable};      my $program = $opts->{executable};
306      delete $opts->{executable};      delete $opts->{executable};
307    
308        # determine execution method
309        my $wrapper_program = '';
310        
311        # check if program is a namespace-string (contains '::') - use 'do' in this case!
312        if ($program =~ /::/) {
313          #$wrapper_program = 'rap.pl';
314          $wrapper_program = $0;
315        }
316    
317        # prepare arguments
318      my @buf;      my @buf;
319      foreach (keys %$opts) {      foreach (keys %$opts) {
320        my $value = $opts->{$_};        my $value = $opts->{$_};
# Line 314  sub run_executable { Line 333  sub run_executable {
333        }        }
334        push @buf, "--$_=$value";        push @buf, "--$_=$value";
335      }      }
336      
337      my $cmd = $program . ' ' . join(' ', @buf);      # build {program} & {arguments}  
338        my $cmd = ($wrapper_program ? $wrapper_program . ' ' : '') . $program . ' ' . join(' ', @buf);
339            
340      # trace      # trace
341        #print "command: $cmd", "\n";        #print "command: $cmd", "\n";
# Line 328  sub run_executable { Line 348  sub run_executable {
348        $ENV{PERL5LIB} = $INC[0];        $ENV{PERL5LIB} = $INC[0];
349                
350        #print Dumper(%ENV);        #print Dumper(%ENV);
351        run_cmd($cmd);        
352          #print "command: '$cmd'", "\n";
353    
354          # V1 - basic
355          #run_cmd($cmd);
356    
357          # V1.b - enhanced: variable local method
358          my $evalstr = "run_cmd('$cmd', 'Some task...', { async => 1 });";
359          eval($evalstr);
360          #my $res = do "$cmd";
361          #print $res, "\n" if $res;
362    
363          #$self->log("run_executable: $evalstr", 'info');
364          $self->raiseException("run_executable: $evalstr\n$@") if $@;
365    
366        # V2: via IPC::Run        # V2: via IPC::Run
367        # ....  (TODO)        # ....  (TODO)
368              
369            
370    }    }
371        

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.7

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed