summaryrefslogtreecommitdiff
path: root/Debian/Dgit/ExitStatus.pm
blob: b69d42deb544a048a58dbb7448fa41b1664d8876 (plain)
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
# -*- perl -*-

package Debian::Dgit::ExitStatus;

# To use this, at the top (before use strict, even):
#
#   END { $? = $Debian::Dgit::ExitStatus::desired // -1; };
#   use Debian::Dgit::ExitStatus;
#
# and then replace every call to `exit' with `finish'.
# Add a `finish 0' to the end of the program.

BEGIN {
    use Exporter;
    @ISA = qw(Exporter);
    @EXPORT = qw(finish $desired);
}

our $desired;

sub finish ($) {
    $desired = $_[0] // 0;
    exit $desired;
}

1;