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.


In reply to Re: Converting to sub signatures by hv
in thread Converting to sub signatures by cavac

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.