in reply to Try::Tiny complaining catch must be block or sub {} (not reference constructor)
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Try::Tiny complaining catch must be block or sub {} (not reference constructor)
by hotshoe (Novice) on Jan 07, 2019 at 00:03 UTC | |
by haukex (Archbishop) on Jan 07, 2019 at 14:36 UTC | |
by hotshoe (Novice) on Jan 07, 2019 at 21:26 UTC |