Subject: | Incorrect capture of codeblock containig '//' operator |
use 5.010;
use Text::Balanced qw(extract_codeblock);
# A string begins from some codeblock (Text::Balanced parses it good):
$text = q#('error', 'Operation failed, check "' . ($this->{'__CF'} ||
'unknown unit') . '"');
return undef;
}
sub data {
my @tokens = map { split(/\./o) } @_;
}
#;
($codeblock, $rest) = extract_codeblock($text, '()');
# Propertly captured codeblock
$text = q#('error', 'Operation failed, check "' . ($this->{'__CF'} //
'unknown unit') . '"');
return undef;
}
sub data {
my @tokens = map { split(/\./o) } @_;
}
#;
($codeblock, $rest) = extract_codeblock($text, '()');
# Codeblock was not captured
# Other new Perl operators, "~~" and "..." are ok in this case.