Bump for 3.6-28
[LibreOffice.git] / solenv / bin / modules / par2script / exiter.pm
blob0c9213a3558778830a2e42bddde9c98b1d7a10df
1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 # Copyright 2000, 2010 Oracle and/or its affiliates.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # This file is part of OpenOffice.org.
11 # OpenOffice.org is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU Lesser General Public License version 3
13 # only, as published by the Free Software Foundation.
15 # OpenOffice.org is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU Lesser General Public License version 3 for more details
19 # (a copy is included in the LICENSE file that accompanied this code).
21 # You should have received a copy of the GNU Lesser General Public License
22 # version 3 along with OpenOffice.org. If not, see
23 # <http://www.openoffice.org/license.html>
24 # for a copy of the LGPLv3 License.
26 #*************************************************************************
29 package par2script::exiter;
31 use par2script::files;
32 use par2script::globals;
34 ############################################
35 # Exiting the program with an error
36 # This function is used instead of "die"
37 ############################################
39 sub exit_program
41 my ($message, $function) = @_;
43 my $infoline;
45 $infoline = "\n***************************************************************\n";
46 push(@par2script::globals::logfileinfo, $infoline);
47 print("$infoline");
49 $infoline = "$message\n";
50 push(@par2script::globals::logfileinfo, $infoline);
51 print("$infoline");
53 $infoline = "in function: $function\n";
54 push(@par2script::globals::logfileinfo, $infoline);
55 print("$infoline");
57 $infoline = "***************************************************************\n";
58 push(@par2script::globals::logfileinfo, $infoline);
60 if ($par2script::globals::logging)
62 par2script::files::save_file($par2script::globals::logfilename, \@par2script::globals::logfileinfo);
63 print("Saved logfile: $par2script::globals::logfilename\n");
66 print("$infoline");
68 exit(-1);
71 #####################################
72 # Error, because a gid is defined
73 # more than once
74 #####################################
76 sub multidefinitionerror
78 my ( $multidefinitiongids ) = @_;
79 print "************************************************\n";
80 print "ERROR: multiple definition of gids:\n";
81 print "************************************************\n";
83 my $gid;
84 foreach $gid ( @{$multidefinitiongids} ) { print "\t$gid\n"; }
85 exit(-1);
88 #####################################
89 # Error, because a gid is assigned
90 # more than once
91 #####################################
93 sub multiassignmenterror
95 my ( $multiassignmentgids ) = @_;
96 print "************************************************\n";
97 print "WARNING: multiple assignments of gids:\n";
98 print "************************************************\n";
100 my $line;
101 foreach $line ( @{$multiassignmentgids} ) { print "\t$line\n"; }
104 #####################################
105 # Error, because a defined gid
106 # is not assigned
107 #####################################
109 sub missingassignmenterror
111 my ( $missingassignmentgids ) = @_;
112 print "********************************************************\n";
113 print "ERROR: Missing assignments for the following GIDs:\n";
114 print "********************************************************\n";
116 my $gid;
117 foreach $gid ( @{$missingassignmentgids} ) { print "\t$gid\n"; }
118 exit(-1);