Revision: 1377
Author: [email protected]
Date: Sat Oct  2 14:52:02 2010
Log: Improve handling of embedded filenames, e.g., "(eval N)[$path]"
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1377

Modified:
 /trunk/Changes
 /trunk/lib/Devel/NYTProf/FileInfo.pm
 /trunk/lib/Devel/NYTProf/Reader.pm

=======================================
--- /trunk/Changes      Sat Oct  2 14:19:06 2010
+++ /trunk/Changes      Sat Oct  2 14:52:02 2010
@@ -9,6 +9,7 @@
 =head2 Changes in Devel::NYTProf 4.06 (svn XXX) XXX

   Improved handling of Class::MOP/Moose generated methods.
+  Improved handling of embedded filenames, e.g., "(eval N)[$path]"
   Added note to the docs re profiling applications that use Coro.
   Clarified usecputime=1 docs.
   Updated tests for new functionality in Sub::Name 0.06.
=======================================
--- /trunk/lib/Devel/NYTProf/FileInfo.pm        Wed Sep 15 02:51:09 2010
+++ /trunk/lib/Devel/NYTProf/FileInfo.pm        Sat Oct  2 14:52:02 2010
@@ -420,12 +420,16 @@
 }


-# should return the filename that the application used
-# when loading the file
+# Should return the filename that the application used when loading the file +# For evals should remove the @INC portion from within the "(eval N)[$path]"
+# and similarly for Class::MOP #line evals "... defined at $path".
+# This is a bit of a fudge. Filename handling should be improved in the profiler.
 sub filename_without_inc {
     my $self = shift;
     my $f    = [$self->filename];
-    strip_prefix_from_paths([$self->profile->inc], $f);
+    strip_prefix_from_paths([$self->profile->inc], $f,
+        qr/(?: ^ | \[ | \sdefined\sat\s )/x
+    );
     return $f->[0];
 }

=======================================
--- /trunk/lib/Devel/NYTProf/Reader.pm  Sat Oct  2 14:15:17 2010
+++ /trunk/lib/Devel/NYTProf/Reader.pm  Sat Oct  2 14:52:02 2010
@@ -172,7 +172,7 @@
     $level ||= $self->current_level;

     my $fname = html_safe_filename($fi->filename_without_inc);
-    $fname .= "-".$fi->fid;
+    $fname .= "-".$fi->fid; # to ensure uniqueness and for info
     $fname .= "-$level" if $level;

     return $fname;

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