BEGIN { $^W = 1; } use AA::BB; use strict 'refs'; print "Caught exception $@" unless eval { do { &CORE::GLOBAL::die('AA::BB'->new) } }; test.pl syntax OK #### #! /usr/bin/perl -w use strict; use AA::BB; eval { die AA::BB->new; } or print "Caught exception $@"; #### package AA::BB; sub die(@) { print "die called with args '@_'" }; sub import { *CORE::GLOBAL::die = \¨ } sub new { return bless {},shift; } 1; #### die called with args 'AA::BB=HASH(0x81761c8)'