package Error::Custom; use strict; use Exporter; use Carp; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK ); $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT = qw(check_call); @EXPORT_OK = qw(check_call); sub check_call { my $custom_message = shift; my @call = @_; # check for 0 return status return unless $?; # bugger, we have an error so tell all # Work out return code my $rc = $? >> 8; confess qq! System call failed Error code $rc $custom_message Actual call was system( "@call" ) !; } 1;