Defined, But Never Called

mako132 on 2002-11-22T20:01:06

More code review rebop: During this week's code review meeting we spent 15 minutes raking a poorly-coded subroutine through the coals, only to discover that it was never called in the CGI!

So I was wondering one might test for that...do I need to compile perl with debugging enabled?

This is a different issue than detecting code that is never reached or isn't reached in the normal functioning of the CGI. The subroutine is simply never called anywhere.

So I need to get a list of all the subroutines and then somehow look at byte-code-execution tree whatnot and see there's no entry point. [here the author waves hands frantically]. I have no idea what I'm talking about :(

Now Drinking: Diet Coke


B::Xref ?

rafael on 2002-11-22T20:29:41

Perhaps could it help.

Profile the application!

brian_d_foy on 2002-11-23T17:30:17

Tools like Devel::SmallProf and Devel::DProf, can profile your application. I wrote a profiling article and a article about creating nifty visual displays of code flow.

Devel::Cover can help you analyze various coverage metrics, too.

Re:Profile the application!

mako132 on 2002-11-26T20:58:01

True, but in this case it is very difficult to actually run the application. It's a Win32 CGI and needs some special modules and Apache config. While possible, setting up a similar system on a test machine requires some work.

Alas, it is work that needs to be done...