######################################################################
eval { $freezed = freeze $obj[4] };
-ok($@ =~ /The result of B::Deparse::coderef2text was empty/);
+ok($@, qr/The result of B::Deparse::coderef2text was empty/);
######################################################################
# Test dclone
$freezed = freeze $obj[$i];
$@ = "";
eval { $thawed = thaw $freezed };
- ok($@ =~ /Can\'t eval/);
+ ok($@, qr/Can\'t eval/);
}
}
for my $i (0 .. 1) {
$@ = "";
eval { $freezed = freeze $obj[$i] };
- ok($@ =~ /Can\'t store CODE items/);
+ ok($@, qr/Can\'t store CODE items/);
}
}
$@ = "";
eval { $thawed = thaw $freezed };
ok($@, "");
- ok($$thawed =~ /^sub/);
+ ok($$thawed, qr/^sub/);
}
}
$freezed = freeze $obj[0]->[6];
eval { $thawed = thaw $freezed };
- ok($@ =~ /trapped/);
+ # The "Code sub ..." error message only appears if Log::Agent is installed
+ ok($@, qr/(trapped|Code sub)/);
if (0) {
# Disable or fix this test if the internal representation of Storable
substr($freezed, -1, 0, $bad_code);
$@ = "";
eval { $thawed = thaw $freezed };
- ok($@ =~ /trapped/);
+ ok($@, qr/(trapped|Code sub)/);
}
}