CC: | khw [...] cpan.org |
Subject: | Current Devel::Declare breaks TryCatch (under some circumstances) |
The following small script breaks with new Devel::Declare, if piped into the perl interpreter:
$ cat test.pl
BEGIN { binmode STDIN, ":encoding(utf8)" }
use TryCatch;
try {
} catch ($e) {
}
$ cat test.pl | perl5.30.3 -c
Couldn't find declarator 'try' at /opt/perl-5.30.3/lib/site_perl/5.30.3/x86_64-linux/Devel/Declare/Context/Simple.pm line 47.
Devel::Declare::Context::Simple::skip_declarator(TryCatch=HASH(0x55d729d96448)) called at /opt/perl-5.30.3/lib/site_perl/5.30.3/x86_64-linux/TryCatch.pm line 83
TryCatch::_parse_try("TryCatch", "main", "try", 0) called at /opt/perl-5.30.3/lib/site_perl/5.30.3/x86_64-linux/TryCatch.pm line 44
TryCatch::__ANON__("try", 0) called at /opt/perl-5.30.3/lib/site_perl/5.30.3/x86_64-linux/Devel/Declare.pm line 277
Devel::Declare::linestr_callback("const", "try", 0) called at - line 3
It does not fail if the script is called "normally" using "perl5.30.3 -c test.pl"
It does not fail if the binmode() call is removed or moved to runtime.
It does not fail in any case with older Devel::Declare (tried 0.006019).
The "Couldn't find declarator" errors are mentioned also in https://rt.cpan.org/Ticket/Display.html?id=131226 , so this could be a related or even the same issue.