-my $cat = wrap 'main::cat', ref => 'main::myref', wrong_ref => 'die "hlagh"',
- sub => 1, compile => 1,
-my @tests = (
- [ \'a', \'b', [ 'ab' ], 'scalar-scalar' ],
- [ \'c', [ qw/d e/ ], [ qw/c d e/ ], 'scalar-array' ],
- [ [ qw/f g/ ], \'h', [ qw/f g h/ ], 'array-scalar' ],
- [ [ qw/i j/ ], [ qw/k l/ ], [ qw/i j k l/ ], 'array-array' ]
-);
-for (@tests) {
- my $res = [ $cat->($_->[0], $_->[1]) ];
- is_deeply($res, $_->[2], 'cat ' . $_->[3]);
+SKIP: {
+ skip 'perl 5.8.x is needed to test execution of \[$@] prototypes' => 6
+ if $^V lt v5.8.0;
+
+ my $cat = wrap 'main::cat', ref => 'main::myref', wrong_ref => 'die "hlagh"',
+ sub => 1, compile => 1;
+ my @tests = (
+ [ \'a', \'b', [ 'ab' ], 'scalar-scalar' ],
+ [ \'c', [ qw/d e/ ], [ qw/c d e/ ], 'scalar-array' ],
+ [ [ qw/f g/ ], \'h', [ qw/f g h/ ], 'array-scalar' ],
+ [ [ qw/i j/ ], [ qw/k l/ ], [ qw/i j k l/ ], 'array-array' ]
+ );
+ for (@tests) {
+ my $res = [ $cat->($_->[0], $_->[1]) ];
+ is_deeply($res, $_->[2], 'cat ' . $_->[3]);
+ }
+ eval { $cat->({ foo => 1 }, [ 2 ] ) };
+ like($@, qr/^hlagh\s+at/, 'wrong reference type 1');
+ eval { $cat->(\1, sub { 2 } ) };
+ like($@, qr/^hlagh\s+at/, 'wrong reference type 2');