1 |
#!/usr/bin/perl |
2 |
|
3 |
## ------------------------------------------------------------------------- |
4 |
## $Id: rap.pl,v 1.1 2003/02/18 15:30:52 joko Exp $ |
5 |
## ------------------------------------------------------------------------- |
6 |
## $Log: rap.pl,v $ |
7 |
## Revision 1.1 2003/02/18 15:30:52 joko |
8 |
## + initial commit |
9 |
## |
10 |
## ------------------------------------------------------------------------- |
11 |
|
12 |
|
13 |
use strict; |
14 |
use warnings; |
15 |
|
16 |
BEGIN { |
17 |
use FindBin qw($Bin); |
18 |
use lib "$Bin/../../libs"; |
19 |
} |
20 |
|
21 |
|
22 |
# ------------------------------------ main ------------ |
23 |
use Data::Dumper; |
24 |
use Data::Rap; |
25 |
use Cwd; |
26 |
use File::Spec::Functions qw( splitpath splitdir catpath catdir ); |
27 |
|
28 |
|
29 |
sub find_rules { |
30 |
my $cwd = cwd(); |
31 |
|
32 |
(my $volume, my $directory, my $file) = splitpath( $cwd ); |
33 |
my @dir = splitdir($directory); |
34 |
pop @dir; |
35 |
#pop @dir; |
36 |
my $base = catpath($volume, catdir(@dir)); |
37 |
|
38 |
my $rap_xml = "$base/etc/rap.xml"; |
39 |
return $rap_xml; |
40 |
} |
41 |
|
42 |
sub main { |
43 |
my $argString = shift; |
44 |
my $rulesfile = find_rules(); |
45 |
my $rap = Data::Rap->new( filename => $rulesfile, target => $argString ); |
46 |
$rap->start(); |
47 |
} |
48 |
|
49 |
my @args = @ARGV; |
50 |
@args = () if not @args; |
51 |
main(join(' ', @args)); |
52 |
|
53 |
|
54 |
1; |
55 |
__END__ |