xref: /aoo41x/main/solenv/bin/modules/pre2par/exiter.pm (revision 9780544f)
1*9780544fSAndrew Rist#**************************************************************
2*9780544fSAndrew Rist#
3*9780544fSAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
4*9780544fSAndrew Rist#  or more contributor license agreements.  See the NOTICE file
5*9780544fSAndrew Rist#  distributed with this work for additional information
6*9780544fSAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
7*9780544fSAndrew Rist#  to you under the Apache License, Version 2.0 (the
8*9780544fSAndrew Rist#  "License"); you may not use this file except in compliance
9*9780544fSAndrew Rist#  with the License.  You may obtain a copy of the License at
10*9780544fSAndrew Rist#
11*9780544fSAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
12*9780544fSAndrew Rist#
13*9780544fSAndrew Rist#  Unless required by applicable law or agreed to in writing,
14*9780544fSAndrew Rist#  software distributed under the License is distributed on an
15*9780544fSAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9780544fSAndrew Rist#  KIND, either express or implied.  See the License for the
17*9780544fSAndrew Rist#  specific language governing permissions and limitations
18*9780544fSAndrew Rist#  under the License.
19*9780544fSAndrew Rist#
20*9780544fSAndrew Rist#**************************************************************
21*9780544fSAndrew Rist
22*9780544fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweirpackage pre2par::exiter;
25cdf0e10cSrcweir
26cdf0e10cSrcweiruse pre2par::files;
27cdf0e10cSrcweiruse pre2par::globals;
28cdf0e10cSrcweir
29cdf0e10cSrcweir############################################
30cdf0e10cSrcweir# Exiting the program with an error
31cdf0e10cSrcweir# This function is used instead of "die"
32cdf0e10cSrcweir############################################
33cdf0e10cSrcweir
34cdf0e10cSrcweirsub exit_program
35cdf0e10cSrcweir{
36cdf0e10cSrcweir	my ($message, $function) = @_;
37cdf0e10cSrcweir
38cdf0e10cSrcweir	my $infoline;
39cdf0e10cSrcweir
40cdf0e10cSrcweir	$infoline = "\n***************************************************************\n";
41cdf0e10cSrcweir	push(@pre2par::globals::logfileinfo, $infoline);
42cdf0e10cSrcweir	print("$infoline");
43cdf0e10cSrcweir
44cdf0e10cSrcweir	$infoline = "$message\n";
45cdf0e10cSrcweir	push(@pre2par::globals::logfileinfo, $infoline);
46cdf0e10cSrcweir	print("$infoline");
47cdf0e10cSrcweir
48cdf0e10cSrcweir	$infoline = "in function: $function\n";
49cdf0e10cSrcweir	push(@pre2par::globals::logfileinfo, $infoline);
50cdf0e10cSrcweir	print("$infoline");
51cdf0e10cSrcweir
52cdf0e10cSrcweir	$infoline = "***************************************************************\n";
53cdf0e10cSrcweir	push(@pre2par::globals::logfileinfo, $infoline);
54cdf0e10cSrcweir
55cdf0e10cSrcweir	if ($pre2par::globals::logging)
56cdf0e10cSrcweir	{
57cdf0e10cSrcweir		pre2par::files::save_file($pre2par::globals::logfilename ,\@pre2par::globals::logfileinfo);
58cdf0e10cSrcweir		print("Saved logfile: $pre2par::globals::logfilename\n");
59cdf0e10cSrcweir	}
60cdf0e10cSrcweir
61cdf0e10cSrcweir	print("$infoline");
62cdf0e10cSrcweir
63cdf0e10cSrcweir	exit(-1);
64cdf0e10cSrcweir}
65cdf0e10cSrcweir
66cdf0e10cSrcweir1;
67