Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 36da7705

Von Moritz Bunkus vor mehr als 12 Jahren hinzugefügt

  • ID 36da77056776b6a84470fe7a3665077943f846b9
  • Vorgänger dc8fb58c
  • Nachfolger 2dffed32

Modul "SL::System::Process" für system-relevante Befehle

Wie z.B. einer Funktion, die den absoluten Pfad zu den
Kivitendo-Programmdateien zurückliefert.

Unterschiede anzeigen:

SL/System/Process.pm
1
package SL::System::Process;
2

  
3
use strict;
4

  
5
use parent qw(Rose::Object);
6

  
7
use English qw(-no_match_vars);
8
use File::Spec;
9
use File::Basename;
10

  
11
sub exe_dir {
12
  my $dir        = dirname(File::Spec->rel2abs($PROGRAM_NAME));
13
  my $system_dir = File::Spec->catdir($dir, 'SL', 'System');
14
  return $dir if -d $system_dir && -f File::Spec->catfile($system_dir, 'TaskServer.pm');
15

  
16
  my @dirs = reverse File::Spec->splitdir($dir);
17
  shift @dirs;
18
  $dir        = File::Spec->catdir(reverse @dirs);
19
  $system_dir = File::Spec->catdir($dir, 'SL', 'System');
20
  return File::Spec->curdir unless -d $system_dir && -f File::Spec->catfile($system_dir, 'TaskServer.pm');
21

  
22
  return $dir;
23
}
24

  
25
1;
26
__END__
27

  
28
=pod
29

  
30
=encoding utf8
31

  
32
=head1 NAME
33

  
34
SL::System::Process - assorted system-relevant functions
35

  
36
=head1 SYNOPSIS
37

  
38
  # Get base path to Kivitendo scripts
39
  my $path = SL::System::Process->exe_dir;
40

  
41
=head1 FUNCTIONS
42

  
43
=over 4
44

  
45
=item C<exe_dir>
46

  
47
Returns the absolute path to the directory the Kivitendo executables
48
(C<login.pl> etc.) and modules (sub-directory C<SL/> etc.) are located
49
in.
50

  
51
=back
52

  
53
=head1 BUGS
54

  
55
Nothing here yet.
56

  
57
=head1 AUTHOR
58

  
59
Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
60

  
61
=cut

Auch abrufbar als: Unified diff