Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Using Devel::NYTProf with CGI::Application

by jvector (Friar)
on Aug 08, 2012 at 13:52 UTC ( [id://986281] : perlquestion . print w/replies, xml ) Need Help??

jvector has asked for the wisdom of the Perl Monks concerning the following question:


I am interested in profiling a web application built with CGI::Application, using Devel::NYTProf.

The docs for NYTProf recommend running a Perl file directly from the command line; or, for profiling under Apache, putting a PerlModule line in httpd.conf. However, this latter method presupposes that one has mod_perl enabled which is not the case in my environment.

I've tried, from the command line, running individual test scripts from the t/ directory but I would quite like to get a profile of the site whilst it's being used from a browser session.

Is that a sensible/reasonable thing to be seeking, and if so can it be done?

  • Comment on Using Devel::NYTProf with CGI::Application

Replies are listed 'Best First'.
Re: Using Devel::NYTProf with CGI::Application
by rsteiner (Scribe) on Sep 26, 2012 at 17:21 UTC

    Yes, you can do this.

    Just modify the shebang line of your CGI::Application Instance script to something like the following:

    #!/usr/bin/perl -d:NYTProf

    The output file should be created in the same directory as the instance script.

      Thank you very much - that Just Worked! And I do apologise for the late reply - I have only just seen this.
      Gr8 .. Thanks a lot :)
      Hi.. But this file is NYTprof.out is not in readable format. I tried to open it with Browser (ie, mozilla).. but no success.plz advise.