Test-Kit
view release on metacpan or search on metacpan
lib/Test/Kit.pm view on Meta::CPAN
# The logic here is copied from Moose which always causes strict and
# warnings to be enabled when it is used.
#
# A comment in Moose::Exporter states:
#
# "this works because both pragmas set $^H (see perldoc perlvar) which
# affects the current compilation - i.e. the file who use'd us - which
# is why we don't need to do anything special to make it affect that
# file rather than this one (which is already compiled)"
#
# In the Moose code the author simply calls strict->import() in the
# appropriate import() method and that does the trick. For us working
# at a bit more of a distance we have to be a bit trickier - adding
# strict->import() or warnings->import() to the import method on the
# target class. We do that by wrapping it with Hook::LexWrap::wrap().
#
if ($Test::Builder::VERSION < 1.3 && ($package eq 'strict' || $package eq 'warnings')) {
wrap "${target}::import", post => sub { $package->import(); };
}
else {
my $fake_package = $class->_create_fake_package($package, $include_hashref->{$package}, $target);
$fake_package->import::into($target);
}
}
( run in 0.346 second using v1.01-cache-2.11-cpan-299005ec8e3 )