| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#! perl -- -*- coding: utf-8 -*- |
|
2
|
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
17817
|
use utf8; |
|
|
6
|
|
|
|
|
34
|
|
|
|
6
|
|
|
|
|
18
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# EB.pm -- EekBoek Base module. |
|
6
|
|
|
|
|
|
|
# Author : Johan Vromans |
|
7
|
|
|
|
|
|
|
# Created On : Fri Sep 16 18:38:45 2005 |
|
8
|
|
|
|
|
|
|
# Last Modified By: Johan Vromans |
|
9
|
|
|
|
|
|
|
# Last Modified On: Wed Mar 23 11:17:11 2011 |
|
10
|
|
|
|
|
|
|
# Update Count : 320 |
|
11
|
|
|
|
|
|
|
# Status : Unknown, Use with caution! |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package main; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $app; |
|
16
|
|
|
|
|
|
|
our $cfg; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package EB; |
|
19
|
|
|
|
|
|
|
|
|
20
|
6
|
|
|
6
|
|
264
|
use strict; |
|
|
6
|
|
|
|
|
6
|
|
|
|
6
|
|
|
|
|
113
|
|
|
21
|
6
|
|
|
6
|
|
16
|
use base qw(Exporter); |
|
|
6
|
|
|
|
|
8
|
|
|
|
6
|
|
|
|
|
485
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
6
|
|
|
6
|
|
1500
|
use EekBoek; |
|
|
6
|
|
|
|
|
8
|
|
|
|
6
|
|
|
|
|
2359
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our @EXPORT; |
|
26
|
|
|
|
|
|
|
our @EXPORT_OK; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Establish location of our run-time resources. |
|
29
|
|
|
|
|
|
|
my $lib; |
|
30
|
|
|
|
|
|
|
sub libfile { |
|
31
|
6
|
|
|
6
|
0
|
9
|
my ($f) = @_; |
|
32
|
|
|
|
|
|
|
|
|
33
|
6
|
50
|
|
|
|
15
|
unless ( $lib ) { |
|
34
|
|
|
|
|
|
|
# Cava. |
|
35
|
6
|
50
|
|
|
|
15
|
if ( $Cava::Packager::PACKAGED ) { |
|
36
|
0
|
|
|
|
|
0
|
return Cava::Packager::GetResourcePath()."/$f"; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
else { |
|
39
|
6
|
|
|
|
|
13
|
$lib = $INC{"EB.pm"}; |
|
40
|
6
|
|
|
|
|
28
|
$lib =~ s/EB\.pm$//; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
} |
|
43
|
6
|
|
|
|
|
22
|
$lib."EB/res/$f"; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub findlib { |
|
47
|
28
|
|
|
28
|
0
|
83034
|
my ($file, $section) = @_; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# The two-argument form supports locale-dependent paths. |
|
50
|
28
|
100
|
66
|
|
|
106
|
if ( $section && $cfg ) { |
|
|
|
50
|
|
|
|
|
|
|
51
|
6
|
|
|
|
|
19
|
my $lang = $cfg->val( qw( locale lang ), "" ); |
|
52
|
6
|
50
|
|
|
|
16
|
if ( $lang =~ /\./ ) { |
|
53
|
0
|
|
|
|
|
0
|
my $found = findlib( "$section/$lang/$file" ); |
|
54
|
0
|
0
|
|
|
|
0
|
return $found if $found; |
|
55
|
0
|
|
|
|
|
0
|
$lang =~ s/\..*//; # strip .utf8 |
|
56
|
|
|
|
|
|
|
} |
|
57
|
6
|
50
|
|
|
|
16
|
if ( $lang =~ /_/ ) { |
|
58
|
6
|
|
|
|
|
22
|
my $found = findlib( "$section/$lang/$file" ); |
|
59
|
6
|
50
|
|
|
|
13
|
return $found if $found; |
|
60
|
6
|
|
|
|
|
24
|
$lang =~ s/_.*//; # strip _US |
|
61
|
|
|
|
|
|
|
} |
|
62
|
6
|
50
|
|
|
|
13
|
if ( $lang ) { |
|
63
|
6
|
|
|
|
|
17
|
my $found = findlib( "$section/$lang/$file" ); |
|
64
|
6
|
50
|
|
|
|
21
|
return $found if $found; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
0
|
|
|
|
|
0
|
return undef; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
elsif ( $section ) { |
|
69
|
0
|
|
|
|
|
0
|
$file = "$section/$file"; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# Cava. |
|
73
|
22
|
50
|
|
|
|
32
|
if ( $Cava::Packager::PACKAGED ) { |
|
74
|
0
|
|
|
|
|
0
|
my $found = Cava::Packager::GetUserFile($file); |
|
75
|
0
|
0
|
|
|
|
0
|
return $found if -e $found; |
|
76
|
0
|
|
|
|
|
0
|
$found = Cava::Packager::GetResource($file); |
|
77
|
0
|
0
|
|
|
|
0
|
return $found if -e $found; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
22
|
|
|
|
|
34
|
foreach ( @INC ) { |
|
81
|
126
|
100
|
|
|
|
1120
|
return "$_/EB/user/$file" if -e "$_/EB/user/$file"; |
|
82
|
123
|
100
|
|
|
|
808
|
return "$_/EB/res/$file" if -e "$_/EB/res/$file"; |
|
83
|
122
|
100
|
|
|
|
859
|
return "$_/EB/$file" if -e "$_/EB/$file"; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
6
|
|
|
|
|
12
|
undef; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
6
|
|
|
6
|
|
2378
|
use lib ( grep { defined } findlib("CPAN") ); |
|
|
6
|
|
|
|
|
2637
|
|
|
|
6
|
|
|
|
|
14
|
|
|
|
6
|
|
|
|
|
34
|
|
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# Some standard modules (locale-free). |
|
91
|
6
|
|
|
6
|
|
2115
|
use EB::Globals; |
|
|
6
|
|
|
|
|
8
|
|
|
|
6
|
|
|
|
|
747
|
|
|
92
|
6
|
|
|
6
|
|
24
|
use Carp; |
|
|
6
|
|
|
|
|
6
|
|
|
|
6
|
|
|
|
|
283
|
|
|
93
|
6
|
|
|
6
|
|
2098
|
use Data::Dumper; |
|
|
6
|
|
|
|
|
25520
|
|
|
|
6
|
|
|
|
|
247
|
|
|
94
|
6
|
|
|
6
|
|
1974
|
use Carp::Assert; |
|
|
6
|
|
|
|
|
8
|
|
|
|
6
|
|
|
|
|
26
|
|
|
95
|
6
|
|
|
6
|
|
1755
|
use EB::Utils; |
|
|
6
|
|
|
|
|
12
|
|
|
|
6
|
|
|
|
|
2859
|
|
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# Export our and the imported globals. |
|
98
|
|
|
|
|
|
|
@EXPORT = ( @EB::Globals::EXPORT, |
|
99
|
|
|
|
|
|
|
@EB::Utils::EXPORT, |
|
100
|
|
|
|
|
|
|
"_T", # @EB::Locale::EXPORT, |
|
101
|
|
|
|
|
|
|
qw(carp croak), # Carp |
|
102
|
|
|
|
|
|
|
qw(Dumper), # Data::Dumper |
|
103
|
|
|
|
|
|
|
qw(findlib libfile), # |
|
104
|
|
|
|
|
|
|
qw(assert affirm), # Carp::Assert |
|
105
|
|
|
|
|
|
|
); |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
our $ident; |
|
108
|
|
|
|
|
|
|
our $imsg; |
|
109
|
|
|
|
|
|
|
my $imsg_saved; |
|
110
|
|
|
|
|
|
|
our $url = "http://www.eekboek.nl"; |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub __init__ { |
|
113
|
6
|
|
50
|
6
|
|
26
|
$imsg_saved = $imsg || ""; |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
# The CLI and GUI use different EB::Locale modules. |
|
116
|
6
|
50
|
33
|
|
|
33
|
if ( $app || $Cava::Packager::PACKAGED && !Cava::Packager::IsLinux() ) { |
|
|
|
|
33
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# We do not have a good gettext for Windows, so use Wx. |
|
118
|
|
|
|
|
|
|
# It's packaged anyway. |
|
119
|
0
|
|
|
|
|
0
|
require EB::Wx::Locale; # provides EB::Locale, really |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
else { |
|
122
|
6
|
|
|
|
|
1834
|
require EB::Locale; |
|
123
|
|
|
|
|
|
|
} |
|
124
|
6
|
|
|
|
|
151
|
EB::Locale::->import; |
|
125
|
6
|
|
|
|
|
26
|
EB::Locale->set_language($ENV{LANG}); |
|
126
|
|
|
|
|
|
|
|
|
127
|
6
|
|
|
|
|
15
|
my $year = 2005; |
|
128
|
6
|
|
|
|
|
99
|
my $thisyear = (localtime(time))[5] + 1900; |
|
129
|
6
|
50
|
|
|
|
35
|
$year .= "-$thisyear" unless $year == $thisyear; |
|
130
|
6
|
|
|
|
|
41
|
$ident = __x("{name} {version}", |
|
131
|
|
|
|
|
|
|
name => $EekBoek::PACKAGE, |
|
132
|
|
|
|
|
|
|
version => $EekBoek::VERSION); |
|
133
|
6
|
|
|
|
|
10
|
my @locextra; |
|
134
|
6
|
50
|
|
|
|
15
|
push(@locextra, _T("Nederlands")) if $EB::Locale::LOCALISER; |
|
135
|
6
|
50
|
|
|
|
37
|
$imsg = __x("{ident}{extra}{locale} -- Copyright {year} Squirrel Consultancy", |
|
|
|
50
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
ident => $ident, |
|
137
|
|
|
|
|
|
|
extra => ($app ? " Wx" : ""), |
|
138
|
|
|
|
|
|
|
locale => (@locextra ? " (".join(", ", @locextra).")" : ""), |
|
139
|
|
|
|
|
|
|
year => $year); |
|
140
|
6
|
50
|
33
|
|
|
56
|
if ( $imsg ne $imsg_saved |
|
|
|
|
33
|
|
|
|
|
|
141
|
|
|
|
|
|
|
&& !( @ARGV && $ARGV[0] =~ /-(P|-?printconfig)$/ ) |
|
142
|
|
|
|
|
|
|
) { |
|
143
|
6
|
|
|
|
|
457
|
warn($imsg, "\n"); |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
eval { |
|
147
|
0
|
|
|
|
|
0
|
require Win32; |
|
148
|
0
|
|
|
|
|
0
|
my @a = Win32::GetOSVersion(); |
|
149
|
0
|
|
|
|
|
0
|
my ($id, $major) = @a[4,1]; |
|
150
|
0
|
0
|
|
|
|
0
|
die unless defined $id; |
|
151
|
0
|
|
|
|
|
0
|
warn(_T("EekBoek is VRIJE software, ontwikkeld om vrij over uw eigen gegevens te kunnen beschikken.")."\n"); |
|
152
|
0
|
|
|
|
|
0
|
warn(_T("Met uw keuze voor het Microsoft Windows besturingssysteem geeft u echter alle vrijheden weer uit handen. Dat is erg triest.")."\n"); |
|
153
|
6
|
50
|
33
|
|
|
86
|
} unless $imsg_saved eq $imsg || $ENV{AUTOMATED_TESTING}; |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub app_init { |
|
158
|
6
|
|
|
6
|
0
|
219958
|
shift; # 'EB' |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
# Load a config file. |
|
161
|
6
|
|
|
|
|
1425
|
require EB::Config; |
|
162
|
6
|
|
|
|
|
11
|
undef $::cfg; |
|
163
|
6
|
|
|
|
|
34
|
EB::Config->init_config( @_ ); |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
# Main initialisation. |
|
166
|
6
|
|
|
|
|
11
|
__init__(); |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
# Initialise locale-dependent formats. |
|
169
|
6
|
|
|
|
|
1349
|
require EB::Format; |
|
170
|
6
|
|
|
|
|
30
|
EB::Format->init_formats(); |
|
171
|
|
|
|
|
|
|
|
|
172
|
6
|
|
|
|
|
13
|
return $::cfg; # until we've got something better |
|
173
|
|
|
|
|
|
|
} |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub EB::Config::Handler::connect_db { |
|
176
|
|
|
|
|
|
|
# Connect to the data base. |
|
177
|
0
|
|
|
0
|
|
|
require EB::DB; |
|
178
|
0
|
|
|
|
|
|
EB::DB::->connect; |
|
179
|
|
|
|
|
|
|
} |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
1; |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
__END__ |