1 |
joko |
1.1 |
#!/usr/bin/perl |
2 |
|
|
|
3 |
|
|
## ------------------------------------------------------------------------- |
4 |
joko |
1.3 |
## $Id: rap.pl,v 1.2 2003/02/18 19:09:07 jonen Exp $ |
5 |
joko |
1.1 |
## ------------------------------------------------------------------------- |
6 |
jonen |
1.2 |
## $Log: rap.pl,v $ |
7 |
joko |
1.3 |
## Revision 1.2 2003/02/18 19:09:07 jonen |
8 |
|
|
## + cwd for linux bootstrap |
9 |
|
|
## |
10 |
jonen |
1.2 |
## Revision 1.1 2003/02/18 15:30:52 joko |
11 |
|
|
## + initial commit |
12 |
|
|
## |
13 |
joko |
1.1 |
## ------------------------------------------------------------------------- |
14 |
|
|
|
15 |
|
|
|
16 |
|
|
use strict; |
17 |
|
|
use warnings; |
18 |
|
|
|
19 |
joko |
1.3 |
|
20 |
|
|
use File::Spec::Functions qw( splitpath splitdir catpath catdir ); |
21 |
|
|
|
22 |
|
|
sub popdir { |
23 |
|
|
my $path = shift; |
24 |
|
|
my $popcount = shift; |
25 |
|
|
(my $volume, my $directory, my $file) = splitpath( $path ); |
26 |
|
|
my @dir = splitdir($directory); |
27 |
|
|
while ($popcount--) { |
28 |
|
|
pop @dir; |
29 |
|
|
} |
30 |
|
|
#pop @dir; |
31 |
|
|
|
32 |
|
|
#my $base = catpath($volume, catdir(@dir)); |
33 |
|
|
my $base = join('/', @dir); |
34 |
|
|
$base = $volume . $base if $volume; |
35 |
|
|
|
36 |
|
|
return $base; |
37 |
|
|
} |
38 |
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
joko |
1.1 |
BEGIN { |
42 |
|
|
use FindBin qw($Bin); |
43 |
joko |
1.3 |
#use lib "$Bin/../../libs"; |
44 |
|
|
my $libpath = popdir($Bin, 2) . '/libs'; |
45 |
|
|
#print "libpath: $libpath", "\n"; |
46 |
|
|
#exit; |
47 |
|
|
my $evs = "use lib '$libpath';"; |
48 |
|
|
#print "evs: $evs", "\n"; |
49 |
|
|
eval($evs); |
50 |
|
|
die($@) if $@; |
51 |
joko |
1.1 |
} |
52 |
|
|
|
53 |
|
|
|
54 |
|
|
# ------------------------------------ main ------------ |
55 |
|
|
use Data::Dumper; |
56 |
|
|
use Data::Rap; |
57 |
jonen |
1.2 |
|
58 |
joko |
1.1 |
|
59 |
|
|
sub main { |
60 |
|
|
my $argString = shift; |
61 |
joko |
1.3 |
my $rap = Data::Rap->new( target => $argString ); |
62 |
joko |
1.1 |
$rap->start(); |
63 |
joko |
1.3 |
#$rap->stop(); |
64 |
joko |
1.1 |
} |
65 |
|
|
|
66 |
|
|
my @args = @ARGV; |
67 |
|
|
@args = () if not @args; |
68 |
|
|
main(join(' ', @args)); |
69 |
|
|
|
70 |
|
|
|
71 |
|
|
1; |
72 |
|
|
__END__ |