}
my %opts = @_;
+
my @keys = qw/data op_info get set len clear free/;
push @keys, 'copy' if MGf_COPY;
push @keys, 'dup' if MGf_DUP;
push @keys, 'local' if MGf_LOCAL;
push @keys, qw/fetch store exists delete copy_key/ if VMG_UVAR;
- my $ret = eval { _wizard(map $opts{$_}, @keys) };
- if (my $err = $@) {
+
+ my ($wiz, $err);
+ {
+ local $@;
+ $wiz = eval { _wizard(map $opts{$_}, @keys) };
+ $err = $@;
+ }
+ if ($err) {
$err =~ s/\sat\s+.*?\n//;
require Carp;
Carp::croak($err);
}
- return $ret;
+
+ return $wiz;
}
=head2 C<cast>
use strict;
use warnings;
-use Test::More tests => 17 * (3 + 4) + 5;
+use Test::More tests => 17 * (3 + 4) + 5 + 1;
use Config qw/%Config/;
eval { dispell $c, $wiz };
is $@, '', "get dispell with out of bounds op_info doesn't croak";
}
+
+{
+ local $@;
+ my $wiz = eval {
+ local $SIG{__WARN__} = sub { die @_ };
+ wizard op_info => "hlagh";
+ };
+ like $@, qr/^Argument "hlagh" isn't numeric in subroutine entry at \Q$0\E/,
+ 'wizard(op_info => "text") throws numeric warnings';
+}