/[cvs]/nfo/perl/scripts/shortcuts/rap.pl
ViewVC logotype

Diff of /nfo/perl/scripts/shortcuts/rap.pl

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

revision 1.2 by jonen, Tue Feb 18 19:09:07 2003 UTC revision 1.3 by joko, Thu Feb 20 21:39:49 2003 UTC
# Line 4  Line 4 
4  ##  $Id$  ##  $Id$
5  ## -------------------------------------------------------------------------  ## -------------------------------------------------------------------------
6  ##  $Log$  ##  $Log$
7    ##  Revision 1.3  2003/02/20 21:39:49  joko
8    ##  - find_rules moved to Rap.pm
9    ##
10  ##  Revision 1.2  2003/02/18 19:09:07  jonen  ##  Revision 1.2  2003/02/18 19:09:07  jonen
11  ##  + cwd for linux bootstrap  ##  + cwd for linux bootstrap
12  ##  ##
# Line 16  Line 19 
19  use strict;  use strict;
20  use warnings;  use warnings;
21    
22    
23    use File::Spec::Functions qw( splitpath splitdir catpath catdir );
24    
25    sub popdir {
26      my $path = shift;
27      my $popcount = shift;
28      (my $volume, my $directory, my $file) = splitpath( $path );
29      my @dir = splitdir($directory);
30      while ($popcount--) {
31        pop @dir;
32      }
33      #pop @dir;
34      
35      #my $base = catpath($volume, catdir(@dir));
36      my $base = join('/', @dir);
37      $base = $volume . $base if $volume;
38      
39      return $base;
40    }
41    
42    
43    
44  BEGIN {  BEGIN {
45    use FindBin qw($Bin);    use FindBin qw($Bin);
46    use lib "$Bin/../../libs";    #use lib "$Bin/../../libs";
47      my $libpath = popdir($Bin, 2) . '/libs';
48      #print "libpath: $libpath", "\n";
49      #exit;
50      my $evs = "use lib '$libpath';";
51      #print "evs: $evs", "\n";
52      eval($evs);
53      die($@) if $@;
54  }  }
55    
56    
57  # ------------------------------------   main   ------------  # ------------------------------------   main   ------------
58  use Data::Dumper;  use Data::Dumper;
59  use Data::Rap;  use Data::Rap;
 use Cwd;  
 use File::Spec::Functions qw( splitpath splitdir catpath catdir );  
   
   
 sub find_rules {  
   my $cwd = cwd();  
60    
   (my $volume, my $directory, my $file) = splitpath( $cwd );  
   my @dir = splitdir($directory);  
   pop @dir;  
   #pop @dir;  
   my $base = catpath($volume, catdir(@dir));  
   
   my $rap_xml = "$base/etc/rap.xml";  
   return $rap_xml;  
 }  
61    
62  sub main {  sub main {
63    my $argString = shift;    my $argString = shift;
64    my $rulesfile = find_rules();    my $rap = Data::Rap->new( target => $argString );
   my $rap = Data::Rap->new( filename => $rulesfile, target => $argString );  
65    $rap->start();    $rap->start();
66      #$rap->stop();
67  }  }
68    
69  my @args = @ARGV;  my @args = @ARGV;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

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