#mydie.pm #a package to export a global die, overriding the perl builtin #reference perldoc perlsub package mydie; require Exporter; use vars qw/@ISA @EXPORT/; @ISA = 'Exporter'; @EXPORT_OK = qw/die/; sub import { my $pkg = shift; return unless @_; my $sym = shift; my $where = ($sym =~ s/^GLOBAL_// ? 'CORE::GLOBAL' : caller(0)); $pkg->export($where, $sym, @_); Exporter::import($pkg,@_); } sub die { print "goodbye cruel world\n"; CORE::die $_[0]; }