line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: Global.pm,v 25fdfba6a43e 2018/10/30 17:07:37 gomor $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# core::global Brik |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
package Metabrik::Core::Global; |
7
|
1
|
|
|
1
|
|
583
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
47
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# Breaking.Feature.Fix |
11
|
|
|
|
|
|
|
our $VERSION = '1.31'; |
12
|
|
|
|
|
|
|
our $FIX = '0'; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
5
|
use base qw(Metabrik); |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
342
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub brik_properties { |
17
|
|
|
|
|
|
|
return { |
18
|
|
|
|
|
|
|
revision => '$Revision: 25fdfba6a43e $', |
19
|
|
|
|
|
|
|
tags => [ qw(main core) ], |
20
|
|
|
|
|
|
|
attributes => { |
21
|
|
|
|
|
|
|
device => [ qw(device) ], |
22
|
|
|
|
|
|
|
family => [ qw(ipv4|ipv6) ], |
23
|
|
|
|
|
|
|
protocol => [ qw(udp|tcp) ], |
24
|
|
|
|
|
|
|
ctimeout => [ qw(seconds) ], |
25
|
|
|
|
|
|
|
rtimeout => [ qw(seconds) ], |
26
|
|
|
|
|
|
|
wtimeout => [ qw(seconds) ], |
27
|
|
|
|
|
|
|
datadir => [ qw(directory) ], |
28
|
|
|
|
|
|
|
username => [ qw(username) ], |
29
|
|
|
|
|
|
|
hostname => [ qw(hostname) ], |
30
|
|
|
|
|
|
|
homedir => [ qw(directory) ], |
31
|
|
|
|
|
|
|
# encoding: see `perldoc Encode::Supported' for other types |
32
|
|
|
|
|
|
|
encoding => [ qw(utf8|ascii) ], |
33
|
|
|
|
|
|
|
exit_on_sigint => [ qw(0|1) ], |
34
|
|
|
|
|
|
|
pid => [ qw(metabrik_main_pid) ], |
35
|
|
|
|
|
|
|
repository => [ qw(repository) ], |
36
|
|
|
|
|
|
|
}, |
37
|
|
|
|
|
|
|
attributes_default => { |
38
|
|
|
|
|
|
|
device => 'eth0', |
39
|
|
|
|
|
|
|
family => 'ipv4', |
40
|
|
|
|
|
|
|
protocol => 'tcp', |
41
|
|
|
|
|
|
|
ctimeout => 5, |
42
|
|
|
|
|
|
|
rtimeout => 5, |
43
|
|
|
|
|
|
|
wtimeout => 5, |
44
|
|
|
|
|
|
|
username => $ENV{USER} || 'root', |
45
|
|
|
|
|
|
|
hostname => $ENV{HOST} || 'localhost', |
46
|
0
|
|
0
|
0
|
1
|
|
homedir => $ENV{HOME} || '/tmp', |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
47
|
|
|
|
|
|
|
encoding => 'utf8', |
48
|
|
|
|
|
|
|
exit_on_sigint => 0, |
49
|
|
|
|
|
|
|
pid => $$, |
50
|
|
|
|
|
|
|
}, |
51
|
|
|
|
|
|
|
require_modules => { |
52
|
|
|
|
|
|
|
'File::Path' => [ qw(make_path) ], |
53
|
|
|
|
|
|
|
}, |
54
|
|
|
|
|
|
|
}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub brik_use_properties { |
58
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
0
|
|
|
|
my $homedir = $ENV{HOME} || '/tmp'; |
61
|
0
|
|
|
|
|
|
my $datadir = $homedir.'/metabrik'; |
62
|
0
|
|
|
|
|
|
my $repository = $homedir.'/metabrik/repository'; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
eval("use File::Path qw(make_path);"); |
65
|
0
|
|
|
|
|
|
File::Path::make_path($homedir, $datadir, $repository, { |
66
|
|
|
|
|
|
|
mode => 0755, |
67
|
|
|
|
|
|
|
}); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
return { |
70
|
0
|
|
|
|
|
|
attributes_default => { |
71
|
|
|
|
|
|
|
homedir => $homedir, |
72
|
|
|
|
|
|
|
datadir => $datadir, |
73
|
|
|
|
|
|
|
repository => $repository, |
74
|
|
|
|
|
|
|
}, |
75
|
|
|
|
|
|
|
}; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
__END__ |