This starts failing on Perl v5.22:
$ perl -MTry::Tiny -e 'sub foo {sub{}} try {} catch \&foo->()' Type of arg 1 to Try::Tiny::catch must be block or sub {} (not referen +ce constructor) at -e line 1, at EOF
From perl5220delta:
The & prototype character now accepts only anonymous subs (sub {...}), things beginning with \&, or an explicit undef. Formerly it erroneously also allowed references to arrays, hashes, and lists. ... In addition, the \& prototype was allowing subroutine calls, whereas now it only allows subroutines: &foo is still permitted as an argument, while &foo() and foo() no longer are.
If you could show us the code that's causing the issue, I'm sure we can suggest an alternative that works on newer Perl versions.
In reply to Re: Try::Tiny complaining catch must be block or sub {} (not reference constructor)
by haukex
in thread Try::Tiny complaining catch must be block or sub {} (not reference constructor)
by hotshoe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |