/[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.11 by joko, Mon Jun 23 17:54:32 2003 UTC revision 1.16 by jonen, Mon Jun 21 14:15:06 2004 UTC
# Line 2  Line 2 
2  ##  $Id$  ##  $Id$
3  ## ----------------------------------------------------------------------  ## ----------------------------------------------------------------------
4  ##  $Log$  ##  $Log$
5    ##  Revision 1.16  2004/06/21 14:15:06  jonen
6    ##  handle path-modifications in a generic way now(fix for BSD)
7    ##
8    ##  Revision 1.15  2004/06/16 16:37:59  joko
9    ##  attempt to get things going in a generic way (Linux/FreeBSD/Win32)
10    ##
11    ##  Revision 1.14  2004/05/12 14:23:31  jonen
12    ##   add comment/code related to PERL5LIB var at different OS's
13    ##
14    ##  Revision 1.13  2003/12/05 05:02:08  joko
15    ##  + minor update: disabled some unnecessary loggers or changed to debug-level
16    ##
17    ##  Revision 1.12  2003/06/24 20:59:51  jonen
18    ##  added option 'detach'
19    ##
20  ##  Revision 1.11  2003/06/23 17:54:32  joko  ##  Revision 1.11  2003/06/23 17:54:32  joko
21  ##  prepared execution of in-process perl-code via eval (not activated yet!)  ##  prepared execution of in-process perl-code via eval (not activated yet!)
22  ##  ##
# Line 54  use Data::Dumper; Line 69  use Data::Dumper;
69  use Hash::Merge qw( merge );  use Hash::Merge qw( merge );
70  use Iterate;  use Iterate;
71    
72  use shortcuts qw( run_cmd );  use shortcuts qw( run_cmd RUNNING_IN_HELL RUNNING_IN_HEAVEN );
73  use Data::Mungle::Code::Ref qw( ref_slot );  use Data::Mungle::Code::Ref qw( ref_slot );
74  use Data::Mungle::Transform::Deep qw( expand deep_copy );  use Data::Mungle::Transform::Deep qw( expand deep_copy );
75  use File::Temp qw/ tempfile tempdir /;  use File::Temp qw/ tempfile tempdir /;
76    
77    my $DEBUG = 0;
78    
79  sub performTarget {  sub performTarget {
80    my $self = shift;    my $self = shift;
# Line 86  sub perform_target { Line 102  sub perform_target {
102    #$self->log($header, 'notice');    #$self->log($header, 'notice');
103    
104    # V3    # V3
105    $self->log("- " x 20, 'info');    #$self->log("- " x 20, 'info');
106    $self->log("Performing Target '$targetname'.", 'notice');    $self->log("Performing Target '$targetname'.", 'notice');
107    
108    #exit;    #exit;
# Line 135  sub perform_details { Line 151  sub perform_details {
151      my $content = $entry->{content};      my $content = $entry->{content};
152      $self->perform_command($command, $args, $content, { warn => 1 } );      $self->perform_command($command, $args, $content, { warn => 1 } );
153      # check recursiveness      # check recursiveness
154      # new condition: don't recurse if node is flagged to have inline-args (2004-04-17)      # new condition: don't recurse if node is flagged to have inline-args (2003-04-17)
155      my $has_inline_args = ($entry->{attrib}->{_args} && $entry->{attrib}->{_args} eq 'inline');      my $has_inline_args = ($entry->{attrib}->{_args} && $entry->{attrib}->{_args} eq 'inline');
156      if ($entry->{content} && ref $entry->{content} && !$has_inline_args) {      if ($entry->{content} && ref $entry->{content} && !$has_inline_args) {
157        $self->perform_details($entry);        $self->perform_details($entry);
158      }      }
159      # new of 2003-05-08      # new of 2003-05-08
160        $command ||= '';
161      $self->perform_command($command . '_end', undef, undef, { warn => 0 } );      $self->perform_command($command . '_end', undef, undef, { warn => 0 } );
162    }    }
163  }  }
# Line 158  sub perform_command { Line 175  sub perform_command {
175    my $options = shift;    my $options = shift;
176    
177    if (!$command) {    if (!$command) {
178      $self->log("Command was empty!", 'debug');      $self->log("Command was empty!", 'debug') if $DEBUG;
179      return;      return;
180    }    }
181    
182    # FIXME: make '__PACKAGE__' go one level deeper properly!    # FIXME: make '__PACKAGE__' go one level deeper properly!
183    $self->log( __PACKAGE__ . "->perform_command: " . $command, 'debug');    $self->log( __PACKAGE__ . "->perform_command: " . $command, 'debug') if $DEBUG;
184        
185        
186    # 1. make arguments from list of arguments(?)    # 1. make arguments from list of arguments(?)
# Line 206  sub perform_command { Line 223  sub perform_command {
223    } else {    } else {
224      my $level = "debug";      my $level = "debug";
225      $level = "warning" if $options->{warn};      $level = "warning" if $options->{warn};
226      $self->log("Command '$command' not implemented.", $level);      $self->log("Command '$command' not implemented.", $level) if $DEBUG;
227    }    }
228        
229  }  }
# Line 333  sub get_property { Line 350  sub get_property {
350    
351      $name = '__rap.properties.' . $name;      $name = '__rap.properties.' . $name;
352            
353      $self->log("get-name: $name");      $self->log("get-name: $name") if $DEBUG;
354            
355      # get property slot and return value      # get property slot and return value
356      $result = ref_slot($self, $name, undef, '.');      $result = ref_slot($self, $name, undef, '.');
# Line 364  sub run_executable { Line 381  sub run_executable {
381    
382    delete $opts->{caption};    delete $opts->{caption};
383    delete $opts->{async};    delete $opts->{async};
384      delete $opts->{detach};
385    
386    #print Dumper($meta);    #print Dumper($meta);
387    
# Line 408  sub run_executable { Line 426  sub run_executable {
426        #print "command: $cmd", "\n";        #print "command: $cmd", "\n";
427            
428      # start process      # start process
429        # V1: via shortcut        # 2004-05-11 - seems like only ONE args is valid at PERL5LIB, so we use V2!
430        #$ENV{PERL5LIB} = join(' ', @INC);        # 2004-06-16 - found out delimiter required for PERL5LIB, reverting back to V1!
431                
432        # FIXME!!! what about the other slots of @INC?        # V1: join all args
433        $ENV{PERL5LIB} = $INC[0];        #my $delimiter = ':';
434          #$delimiter = ';' if RUNNING_IN_HELL();
435          #$ENV{PERL5LIB} = join($delimiter, @INC);
436          # V2: insert only FIRST arg
437          #$ENV{PERL5LIB} = $INC[0];
438          # WARNING: at (free)BSD our var is the SECOND, NOT FIRST!!
439          # FIXME!! Do this in an abstract way!!
440          #$ENV{PERL5LIB} = $INC[1];
441          # V3: mix V1+V2 (because V1 doesn't fit at freeBSD..)
442          if(RUNNING_IN_HEAVEN()) {
443            $ENV{PERL5LIB} = $INC[1];
444          } else {
445            my $delimiter = ':';
446            $delimiter = ';' if RUNNING_IN_HELL();
447            $ENV{PERL5LIB} = join($delimiter, @INC);
448          }
449                
450        #print Dumper(%ENV);        #print Dumper(%ENV);
451                
# Line 424  sub run_executable { Line 457  sub run_executable {
457        # V1.b - enhanced: variable local method        # V1.b - enhanced: variable local method
458        $meta->{caption} ||= '';        $meta->{caption} ||= '';
459        $meta->{async} ||= 0;        $meta->{async} ||= 0;
460          $meta->{detach} ||= 0;
461        # new of 2003-05-08: USE_PATH!        # new of 2003-05-08: USE_PATH!
462        $meta->{USE_PATH} ||= 0;        $meta->{USE_PATH} ||= 0;
463        my $evalstr = "run_cmd('$cmd', '$meta->{caption}', { async => $meta->{async}, USE_PATH => $meta->{USE_PATH} });";        my $evalstr = "run_cmd('$cmd', '$meta->{caption}', { async => $meta->{async}, detach => $meta->{detach}, USE_PATH => $meta->{USE_PATH} });";
464        eval($evalstr);        eval($evalstr);
465        #my $res = do "$cmd";        #my $res = do "$cmd";
466        #print $res, "\n" if $res;        #print $res, "\n" if $res;

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.16

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