in reply to Re^2: Cleaning up unused subroutines
in thread Cleaning up unused subroutines

Hm. I'm not for one moment going to suggest that you are wrong. If the code uses prototypes on one or more of the subs, then the regex would need modification. Likewise, as I coded it, it would ignore anonymous subs.

But, for the sake of completeness, could you describe what other situations might not be covered?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^4: Cleaning up unused subroutines
by Somni (Friar) on Oct 26, 2007 at 04:29 UTC
    perl -wle 'foo() for @ARGV'

    foo() may or may not be called, depending on @ARGV. This is just a very simple example of the larger problem: subroutines may or may not be called based on conditions that can only be determined at run-time.

    The only way to really do this was covered earlier: with a comprehensive test suite and gradual code modification.

      foo() may or may not be called, depending on @ARGV.

      Better. A clear example rather than oblique allusions.

      The only way to really do this was covered earlier: with a comprehensive test suite and gradual code modification.

      And how do you test that your test suite is comprehensive?


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        And how do you test that your test suite is comprehensive?

        With code coverage checks, such as Devel::Cover.