use strict; use warnings; use Test::More tests => 1; my $new; BEGIN { require MIME::Lite; $new = MIME::Lite->can ("new"); no warnings 'redefine'; *MIME::Lite::new = \&MIME_Lite_new_wrapper; } sub MIME_Lite_new_wrapper { print "Validating MIME::Lite::new params\n"; goto $new; } ok (checkSub (), 'Match existing path'); sub checkSub { my $msg = MIME::Lite->new ((To => 'to', )); my $result = eval {$msg->send}; }