[debhelper-devel] Bug#797904: debhelper manpage: #DEBHELPER# in Perl: bad error handling

Jakub Wilk jwilk at debian.org
Thu Sep 3 14:38:52 UTC 2015


Package: debhelper
Version: 9.20150811
Severity: minor

debhelper manpage includes this example of how to embed #DEBHELPER# in 
Perl code:

    my $temp="set -e\nset -- @ARGV\n" . << 'EOF';
    #DEBHELPER#
    EOF
    system ($temp) / 256 == 0
          or die "Problem with debhelper scripts: $!";

The division by 256 is useless. But more importantly, it will almost 
always give you incorrect error message if the embedded script fails. 
This is because system() does not set $! if the program exits normally 
with non-zero exit status.

-- 
Jakub Wilk




More information about the debhelper-devel mailing list