You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you don't put a semicolon after a try/catch this will not always be reported as an error. Instead, the whole construct is ignored. This can lead to hard to debug errors.
The following example reproduces the issue:
use strict;
use warnings;
use perl5i::2;
func get_foo($foo1, $foo2) {
my $retval = 'UNKNOWN';
try
{
my $info = get_foo_info($foo1);
$retval = get_foo_by_info($info, $foo2);
} catch {
warn $_ if $_;
}
return $retval;
}
Sorry about that. It is an unfortunate artifact of how Try::Tiny works (which is what we use for try/catch). try { ... } catch { ... } is actually try( sub { ... }, catch( sub { ... } ) ).
We can chalk this up to another argument for switching to TryCatch which implements proper syntax. See #224
When you don't put a semicolon after a try/catch this will not always be reported as an error. Instead, the whole construct is ignored. This can lead to hard to debug errors.
The following example reproduces the issue:
use strict;
use warnings;
use perl5i::2;
func get_foo($foo1, $foo2) {
my $retval = 'UNKNOWN';
try
{
my $info = get_foo_info($foo1);
$retval = get_foo_by_info($info, $foo2);
} catch {
warn $_ if $_;
}
return $retval;
}
func get_foo_by_cpuinfo($info, $foo2) {
return "$info-$foo2";
}
func get_foo_info($foo1) {
return "foo";
}
print get_foo("./","bar");
The text was updated successfully, but these errors were encountered: