Revision: 1303
Author: [email protected]
Date: Wed Jun 16 15:47:41 2010
Log: Fix nytprofhtml --profself option.

http://code.google.com/p/perl-devel-nytprof/source/detail?r=1303

Modified:
 /trunk/bin/nytprofhtml

=======================================
--- /trunk/bin/nytprofhtml      Thu Jun 10 03:24:38 2010
+++ /trunk/bin/nytprofhtml      Wed Jun 16 15:47:41 2010
@@ -17,6 +17,18 @@
 use List::Util qw(sum max);
 use File::Copy;
 use File::Path qw(rmtree);
+
+# Handle --profself before loading Devel::NYTProf::Core
+# (because it parses NYTPROF for options)
+BEGIN {
+    if (grep { $_ eq '--profself' } @ARGV) {
+        # profile nytprofhtml itself
+        our $profself = "nytprof-nytprofhtml.out";
+        $ENV{NYTPROF} .= ":file=$profself:trace=1";
+        require Devel::NYTProf;
+ END { warn "Profile of $0 written to $profself\n" if our $profself; }
+    }
+}

 use Devel::NYTProf::Reader;
 use Devel::NYTProf::Core;
@@ -57,13 +69,7 @@
     'open!'     => \my $opt_open,
     'help|h'    => sub { exit usage() },
     'minimal|m!'=> \my $opt_minimal,
-    'profself!'     => sub {
-        # profile nytprofhtml itself
-        our $profself = "nytprof-nytprofhtml.out";
-        $ENV{NYTPROF} .= ":file=$profself";
-        require Devel::NYTProf;
- END { warn "Profile of $0 written to $profself\n" if our $profself; }
-    },
+    'profself!'     => sub { }, # handled in BEGIN above
 ) or do { exit usage(); };


--
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.

Group hosted at:  http://groups.google.com/group/develnytprof-dev
Project hosted at:  http://perl-devel-nytprof.googlecode.com
CPAN distribution:  http://search.cpan.org/dist/Devel-NYTProf

To post, email:  [email protected]
To unsubscribe, email:  [email protected]

Reply via email to