plan skip_all => 'No nice uvar magic for this perl';
}
-eval "use Hash::Util::FieldHash";
-if ($@) {
- plan skip_all => 'Hash::Util::FieldHash required for testing uvar interaction';
-} else {
- plan tests => 2 * 5 + 7 + 1;
- defined and diag "Using Hash::Util::FieldHash $_"
+{
+ local $@;
+ if (eval { require Hash::Util::FieldHash; 1 }) {
+ plan tests => 2 * 5 + 7 + 1;
+ defined and diag "Using Hash::Util::FieldHash $_"
for $Hash::Util::FieldHash::VERSION;
+ } else {
+ plan skip_all => 'Hash::Util::FieldHash required for testing uvar interaction'
+ }
}
use lib 't/lib';
my $wiz = init_watcher 'copy', 'copy';
SKIP: {
- eval "use Tie::Array";
+ my $has_tie_array = do { local $@; eval { require Tie::Array; 1 } };
skip 'Tie::Array required to test copy magic on arrays'
- => (2 * 5 + 3) + (2 * 2 + 1) if $@;
+ => (2 * 5 + 3) + (2 * 2 + 1) unless $has_tie_array;
defined and diag "Using Tie::Array $_" for $Tie::Array::VERSION;
tie my @a, 'Tie::StdArray';
}
SKIP: {
- eval "use Tie::Hash";
- skip 'Tie::Hash required to test copy magic on hashes' => 2 * 9 + 6 if $@;
+ my $has_tie_hash = do { local $@; eval { require Tie::Hash; 1 } };
+ skip 'Tie::Hash required to test copy magic on hashes'
+ => 2 * 9 + 6 unless $has_tie_hash;
defined and diag "Using Tie::Hash $_" for $Tie::Hash::VERSION;
tie my %h, 'Tie::StdHash';
is $x, 1, 'uvar: fetch directly with also non uvar magic correctly';
SKIP: {
- eval "use Tie::Hash";
- skip 'Tie::Hash required to test uvar magic on tied hashes' => 2 * 5 + 4 if $@;
+ my $has_tie_hash = do { local $@; eval { require Tie::Hash; 1 } };
+ skip 'Tie::Hash required to test uvar magic on tied hashes'
+ => 2 * 5 + 4 unless $has_tie_hash;
defined and diag "Using Tie::Hash $_" for $Tie::Hash::VERSION;
tie my %h, 'Tie::StdHash';
SKIP: {
my $SKIP;
- unless (MGf_COPY) {
+ if (!MGf_COPY) {
$SKIP = 'No copy magic for this perl';
} else {
- eval "use Tie::Array";
- $SKIP = 'Tie::Array required to test clear magic on tied array values' if $@;
+ local $@;
+ unless (eval { require Tie::Array; 1 }) {
+ $SKIP = 'Tie::Array required to test clear magic on tied array values';
+ }
}
skip $SKIP => 3 if $SKIP;
SKIP: {
my $SKIP;
- unless (VMG_UVAR) {
+ if (!VMG_UVAR) {
$SKIP = 'uvar magic';
} else {
- eval "use B::Deparse";
- $SKIP = 'B::Deparse' if $@;
+ local $@;
+ unless (eval { require B::Deparse; 1 }) {
+ $SKIP = 'B::Deparse';
+ }
}
if ($SKIP) {
$SKIP .= ' required to test uvar/clear interaction fix';