<p>I am working on a web app that uses Perl and I need to look into speeding up portions of the app.  </p>

<p>I thought I'd start profiling the particular calls for the portion I wish to investigate.  I've done some searching on profiling Perl code, but unfortunately most of what I find says that I should run my perl code with <code>-d:DProf myapp</code> from the command line.  That doesn't quite work for me since my code is within a web app.  I did find a way to get the profiling to work with apache, but unfortunately, the "most used" modules that came back from the profiler were all CPAN modules -- Class::xyz, etc etc etc.  Not terribly helpful.</p>

<p>Does anyone know of a good way besides me injecting "timer" code into the methods I wish to profile to target just these methods?  I've thought of writing a test script and profiling that but due to the nature of the code I'm working on that would require a bit more work than I'm hoping to have to do.  </p>

You can use the
Benchmark
core module with the
:hireswallclock
option if you really want to time things internally.   But really, you should be able to profile from the command line.  You might have to write test scripts to emulate certain portions of a CGI request, but DProf can be
extremely
useful when looking for performance bottlenecks.
In particular, look for where your code is calling the CPAN module code.  You may be doing this in loops far more than necessary, so while the time is spent in the CPAN module, refactoring your code can fix the problem.