5 kx
5 kx use strict;
5 kx use warnings FATAL => 'all';
5 kx
5 kx package _kxLab;
5 kx
5 kx sub error
5 kx {
5 kx my $message = shift;
5 kx my $func = shift;
5 kx
5 kx print STDERR "Error: $message\n";
5 kx if( defined( $func ) )
5 kx {
5 kx &$func();
5 kx }
5 kx exit 1;
5 kx }
5 kx
5 kx sub command_error
5 kx {
5 kx my $command = shift;
5 kx my $context = shift;
5 kx
5 kx error( "$command failed at @{$context}[1] line @{$context}[2]" );
5 kx }
5 kx
5 kx sub system
5 kx {
5 kx my $command = shift;
5 kx
5 kx if( system( $command ) )
5 kx {
5 kx my @context = caller;
5 kx command_error($command, \@context);
5 kx }
5 kx }
5 kx
5 kx 1;