1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
|
#! perl -- -*- coding: utf-8 -*-
use utf8;
# EB.pm -- EekBoek Base module.
# Author : Johan Vromans
# Created On : Fri Sep 16 18:38:45 2005
# Last Modified By: Johan Vromans
# Last Modified On: Thu Aug 31 09:57:36 2017
# Update Count : 331
# Status : Unknown, Use with caution!
package main;
our $app;
our $cfg;
package EB;
use strict;
use base qw(Exporter);
use EekBoek;
our @EXPORT;
our @EXPORT_OK;
# Establish location of our run-time resources.
my $lib;
sub libfile {
my ($f) = @_;
unless ( $lib ) {
# Packaged.
if ( $App::Packager::PACKAGED ) {
return App::Packager::GetResourcePath()."/$f";
}
else {
$lib = $INC{"EB.pm"};
$lib =~ s/EB\.pm$//;
}
}
$lib."EB/res/$f";
}
sub findlib {
my ( $file, $section ) = @_;
# The two-argument form supports locale-dependent paths, but
# we hard-wire this to 'nl'.
if ( $section ) {
my $lang = 'nl';
my $found = findlib( "$section/$lang/$file" );
return $found if $found;
$found = findlib( "$section/$file" );
return $found if $found;
return undef;
}
# Packaged.
if ( $App::Packager::PACKAGED ) {
my $found = App::Packager::GetUserFile($file);
return $found if -e $found;
$found = App::Packager::GetResource($file);
return $found if -e $found;
}
foreach ( @INC ) {
return "$_/EB/user/$file" if -e "$_/EB/user/$file";
return "$_/EB/res/$file" if -e "$_/EB/res/$file";
return "$_/EB/$file" if -e "$_/EB/$file";
}
undef;
}
use lib ( grep { defined } findlib("CPAN") );
# Some standard modules (locale-free).
use EB::Globals;
use Carp;
use Data::Dumper;
use EB::Utils;
# We need a glob() that deals with spaces.
use File::Glob ( $] >= 5.016 ? ":bsd_glob" : ":glob" );
# Even though we do not use translations, most of the code is in place.
sub _T { $_[0] }
# Export our and the imported globals.
@EXPORT = ( @EB::Globals::EXPORT,
@EB::Utils::EXPORT,
"_T",
qw(carp croak confess), # Carp
qw(glob), # File::Glob
qw(Dumper), # Data::Dumper
qw(findlib libfile), # <self>
);
our $ident;
our $imsg;
my $imsg_saved;
our $url = "http://www.eekboek.nl";
sub __init__ {
$imsg_saved = $imsg || "";
my $year = 2005;
my $thisyear = (localtime(time))[5] + 1900;
$year .= "-$thisyear" unless $year == $thisyear;
$ident = __x("{name} {version}",
name => $EekBoek::PACKAGE,
version => $EekBoek::VERSION);
$imsg = __x("{ident}{extra} -- Copyright {year} Squirrel Consultancy",
ident => $ident,
extra => ($app ? " Wx" : ""),
year => $year);
if ( $imsg ne $imsg_saved
&& !( @ARGV && $ARGV[0] =~ /-(P|-?printconfig)$/ )
) {
warn($imsg, "\n");
}
eval {
require Win32;
my @a = Win32::GetOSVersion();
my ($id, $major) = @a[4,1];
die unless defined $id;
warn(_T("EekBoek is VRIJE software, ontwikkeld om vrij over uw eigen gegevens te kunnen beschikken.")."\n");
warn(_T("Met uw keuze voor het Microsoft Windows besturingssysteem geeft u echter alle vrijheden weer uit handen. Dat is erg triest.")."\n");
} unless $imsg_saved eq $imsg || $ENV{AUTOMATED_TESTING};
}
sub app_init {
shift; # 'EB'
# Load a config file.
require EB::Config;
undef $::cfg;
EB::Config->init_config( @_ );
# Main initialisation.
__init__();
# Initialise locale-dependent formats.
require EB::Format;
EB::Format->init_formats();
return $::cfg; # until we've got something better
}
sub EB::Config::Handler::connect_db {
# Connect to the data base.
require EB::DB;
EB::DB::->connect;
}
1;
__END__
=head1 NAME
EB - EekBoek * Bookkeeping software for small and medium-size businesses
=head1 SYNOPSIS
EekBoek is a bookkeeping package for small and medium-size businesses.
Unlike other accounting software, EekBoek has both a command-line
interface (CLI) and a graphical user-interface (GUI). Furthermore, it
has a complete Perl API to create your own custom applications.
=head1 DESCRIPTION
For a description how to use the program, see L<http://www.eekboek.nl/docs/index.html>.
=head1 BUGS AND PROBLEMS
Please use the eekboek-users mailing list at SourceForge.
=head1 AUTHOR AND CREDITS
Johan Vromans (jvromans@squirrel.nl) wrote this module.
Web site: L<http://www.eekboek.nl>.
=head1 COPYRIGHT AND DISCLAIMER
This program is Copyright 2005-2011 by Squirrel Consultancy. All
rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of either: a) the GNU General Public License as
published by the Free Software Foundation; either version 1, or (at
your option) any later version, or b) the "Artistic License" which
comes with Perl.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the
GNU General Public License or the Artistic License for more details.
|