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 |
11 |
|
## + cwd for linux bootstrap |
12 |
|
## |
13 |
## Revision 1.1 2003/02/18 15:30:52 joko |
## Revision 1.1 2003/02/18 15:30:52 joko |
14 |
## + initial commit |
## + initial commit |
15 |
## |
## |
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 |
|
|
58 |
use Data::Dumper; |
use Data::Dumper; |
59 |
use Data::Rap; |
use Data::Rap; |
60 |
|
|
|
sub find_rules { |
|
|
return '../etc/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; |