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

BrowserUK -- as noted earlier, this doesn't produce 100% coverage in non-trivial code. Certainly not for code that gets released to a customer for a production system anyway. Good thinking outside the square.
the hardest line to type correctly is: stty erase ^H

Replies are listed 'Best First'.
Re^3: Cleaning up unused subroutines
by BrowserUk (Patriarch) on Oct 26, 2007 at 03:45 UTC

    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.
      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.