/[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.10 by joko, Tue May 13 07:56:12 2003 UTC revision 1.13 by joko, Fri Dec 5 05:02:08 2003 UTC
# Line 2  Line 2 
2  ##  $Id$  ##  $Id$
3  ## ----------------------------------------------------------------------  ## ----------------------------------------------------------------------
4  ##  $Log$  ##  $Log$
5    ##  Revision 1.13  2003/12/05 05:02:08  joko
6    ##  + minor update: disabled some unnecessary loggers or changed to debug-level
7    ##
8    ##  Revision 1.12  2003/06/24 20:59:51  jonen
9    ##  added option 'detach'
10    ##
11    ##  Revision 1.11  2003/06/23 17:54:32  joko
12    ##  prepared execution of in-process perl-code via eval (not activated yet!)
13    ##
14  ##  Revision 1.10  2003/05/13 07:56:12  joko  ##  Revision 1.10  2003/05/13 07:56:12  joko
15  ##  enhanced: *hierarchical* containers for context handling  ##  enhanced: *hierarchical* containers for context handling
16  ##  fixes: some pre-flight checks  ##  fixes: some pre-flight checks
# Line 56  use Data::Mungle::Code::Ref qw( ref_slot Line 65  use Data::Mungle::Code::Ref qw( ref_slot
65  use Data::Mungle::Transform::Deep qw( expand deep_copy );  use Data::Mungle::Transform::Deep qw( expand deep_copy );
66  use File::Temp qw/ tempfile tempdir /;  use File::Temp qw/ tempfile tempdir /;
67    
68    my $DEBUG = 0;
69    
70  sub performTarget {  sub performTarget {
71    my $self = shift;    my $self = shift;
# Line 83  sub perform_target { Line 93  sub perform_target {
93    #$self->log($header, 'notice');    #$self->log($header, 'notice');
94    
95    # V3    # V3
96    $self->log("- " x 20, 'info');    #$self->log("- " x 20, 'info');
97    $self->log("Performing Target '$targetname'.", 'notice');    $self->log("Performing Target '$targetname'.", 'notice');
98    
99    #exit;    #exit;
# Line 132  sub perform_details { Line 142  sub perform_details {
142      my $content = $entry->{content};      my $content = $entry->{content};
143      $self->perform_command($command, $args, $content, { warn => 1 } );      $self->perform_command($command, $args, $content, { warn => 1 } );
144      # check recursiveness      # check recursiveness
145      # 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)
146      my $has_inline_args = ($entry->{attrib}->{_args} && $entry->{attrib}->{_args} eq 'inline');      my $has_inline_args = ($entry->{attrib}->{_args} && $entry->{attrib}->{_args} eq 'inline');
147      if ($entry->{content} && ref $entry->{content} && !$has_inline_args) {      if ($entry->{content} && ref $entry->{content} && !$has_inline_args) {
148        $self->perform_details($entry);        $self->perform_details($entry);
149      }      }
150      # new of 2003-05-08      # new of 2003-05-08
151        $command ||= '';
152      $self->perform_command($command . '_end', undef, undef, { warn => 0 } );      $self->perform_command($command . '_end', undef, undef, { warn => 0 } );
153    }    }
154  }  }
# Line 155  sub perform_command { Line 166  sub perform_command {
166    my $options = shift;    my $options = shift;
167    
168    if (!$command) {    if (!$command) {
169      $self->log("Command was empty!", 'debug');      $self->log("Command was empty!", 'debug') if $DEBUG;
170      return;      return;
171    }    }
172    
173    # FIXME: make '__PACKAGE__' go one level deeper properly!    # FIXME: make '__PACKAGE__' go one level deeper properly!
174    $self->log( __PACKAGE__ . "->perform_command: " . $command, 'debug');    $self->log( __PACKAGE__ . "->perform_command: " . $command, 'debug') if $DEBUG;
175        
176        
177    # 1. make arguments from list of arguments(?)    # 1. make arguments from list of arguments(?)
# Line 203  sub perform_command { Line 214  sub perform_command {
214    } else {    } else {
215      my $level = "debug";      my $level = "debug";
216      $level = "warning" if $options->{warn};      $level = "warning" if $options->{warn};
217      $self->log("Command '$command' not implemented.", $level);      $self->log("Command '$command' not implemented.", $level) if $DEBUG;
218    }    }
219        
220  }  }
# Line 330  sub get_property { Line 341  sub get_property {
341    
342      $name = '__rap.properties.' . $name;      $name = '__rap.properties.' . $name;
343            
344      $self->log("get-name: $name");      $self->log("get-name: $name") if $DEBUG;
345            
346      # get property slot and return value      # get property slot and return value
347      $result = ref_slot($self, $name, undef, '.');      $result = ref_slot($self, $name, undef, '.');
# Line 361  sub run_executable { Line 372  sub run_executable {
372    
373    delete $opts->{caption};    delete $opts->{caption};
374    delete $opts->{async};    delete $opts->{async};
375      delete $opts->{detach};
376    
377    #print Dumper($meta);    #print Dumper($meta);
378    
# Line 421  sub run_executable { Line 433  sub run_executable {
433        # V1.b - enhanced: variable local method        # V1.b - enhanced: variable local method
434        $meta->{caption} ||= '';        $meta->{caption} ||= '';
435        $meta->{async} ||= 0;        $meta->{async} ||= 0;
436          $meta->{detach} ||= 0;
437        # new of 2003-05-08: USE_PATH!        # new of 2003-05-08: USE_PATH!
438        $meta->{USE_PATH} ||= 0;        $meta->{USE_PATH} ||= 0;
439        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} });";
440        eval($evalstr);        eval($evalstr);
441        #my $res = do "$cmd";        #my $res = do "$cmd";
442        #print $res, "\n" if $res;        #print $res, "\n" if $res;
# Line 478  sub run_script { Line 491  sub run_script {
491            
492    } elsif ($args->{language} eq 'bash') {    } elsif ($args->{language} eq 'bash') {
493      $self->log("FIXME: - - - - - -- - - --  BASH -  - -    -  - -   -    --   - ", 'error');      $self->log("FIXME: - - - - - -- - - --  BASH -  - -    -  - -   -    --   - ", 'error');
494    
495      } elsif ($args->{language} eq 'perl') {
496        
497        # reporting
498        #$self->log("Executing some arbitrary unsigned code (probably unsafe). [language=$args->{language}]", 'info');
499        #$self->log("\n<code>\n$code\n</code>", 'info');
500        
501        # do it
502        #eval($code);
503        #$self->log("\n<code>\n$code\n</code>", 'error') if $@;
504            
505    } else {    } else {
506      $self->log("FIXME: Script language '$args->{language}' not implemented.", 'error');      $self->log("FIXME: Script language '$args->{language}' not implemented.", 'error');

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.13

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