Author: tim.bunce
Date: Tue Nov 18 16:06:04 2008
New Revision: 610

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

Log:
Fixed searching @INC for source files for reports.
(Volunteers wanted to add portability to windows etc)


Modified: trunk/Changes
==============================================================================
--- trunk/Changes       (original)
+++ trunk/Changes       Tue Nov 18 16:06:04 2008
@@ -10,6 +10,8 @@
      so you can see more accurate statement execution counts
      for some kinds of constructs.

+  Fixed searching @INC for source files for reports.
+
    Dramatically increased performance of nytprofhtml
      relative to the 2.07 version.


Modified: trunk/lib/Devel/NYTProf/FileInfo.pm
==============================================================================
--- trunk/lib/Devel/NYTProf/FileInfo.pm (original)
+++ trunk/lib/Devel/NYTProf/FileInfo.pm Tue Nov 18 16:06:04 2008
@@ -142,9 +142,19 @@
      # if it's a .pmc then assume that's the file we want to look at
      # (because the main use for .pmc's are related to perl6)
      $filename .= "c" if $self->is_pmc;
-    open my $fh, "<", $filename
-        or return undef;
-    return [ <$fh> ];
+
+    # search @INC if filename is not absolute
+    my @files = ($filename);
+    if ($filename !~ m/^\//) {
+        @files = map { "$_/$filename" } @INC;
+    }
+    for my $file (@files) {
+        open my $fh, "<", $file
+            or next;
+        return [ <$fh> ];
+    }
+
+    return undef;
  }

  1;

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