1 |
joko |
1.1 |
#!/usr/bin/perl |
2 |
|
|
|
3 |
|
|
## ------------------------------------------------------------------------- |
4 |
jonen |
1.2 |
## $Id: rap.pl,v 1.1 2003/02/18 15:30:52 joko Exp $ |
5 |
joko |
1.1 |
## ------------------------------------------------------------------------- |
6 |
jonen |
1.2 |
## $Log: rap.pl,v $ |
7 |
|
|
## Revision 1.1 2003/02/18 15:30:52 joko |
8 |
|
|
## + initial commit |
9 |
|
|
## |
10 |
joko |
1.1 |
## ------------------------------------------------------------------------- |
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 |
jonen |
1.2 |
use Cwd; |
26 |
|
|
use File::Spec::Functions qw( splitpath splitdir catpath catdir ); |
27 |
|
|
|
28 |
joko |
1.1 |
|
29 |
|
|
sub find_rules { |
30 |
jonen |
1.2 |
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 |
joko |
1.1 |
} |
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__ |