in reply to Converting to sub signatures
My first concern would be with regexps like:
if($line =~ /[^\#]*\ *sub\ (.*)\ \{/) {It looks like the intent is to match only outside of comments, but because the pattern is not anchored the initial /[^\#]*/ is effectively a no-op. And because both elements of [^\#]*\ * can be zero-length, this would match eg "for my $sub (@callbacks) {" - I'd definitely want at least a mandatory space (or beginning-of-line).
For the rest, I would find the regexps easier to read if they were expanded with //x (at the cost of having to write \s+ frequently). But it's hard to comment on code that is "quite tied to (your) own coding style" without details of what that is. For example I'll tend to break long lines in particular ways that would not be hard to parse in a line-by-line manner, but in the general case that would be hard to do without a complex state machine.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Converting to sub signatures
by cavac (Prior) on Jun 23, 2022 at 18:33 UTC | |
by kcott (Archbishop) on Jun 23, 2022 at 19:17 UTC | |
by hv (Prior) on Jun 23, 2022 at 19:38 UTC |