Author: thatsafunnyname
Date: Thu Mar 26 06:00:13 2009
New Revision: 724

Modified:
    trunk/bin/nytprofhtml

Log:
Filenames can have chars that are special regexp chars, escaping some I ran  
into on VMS.

Modified: trunk/bin/nytprofhtml
==============================================================================
--- trunk/bin/nytprofhtml       (original)
+++ trunk/bin/nytprofhtml       Thu Mar 26 06:00:13 2009
@@ -481,7 +481,12 @@
              }

              my $href = $reporter->get_file_stats()->{$filename}{html_safe}  
|| "unknown";
-            $line_desc =~ s/ of $filename$// if $filename eq $thisfile;
+           # if $filename conatins F-2 (NYTPROF-2??) then get error - invalid  
regexp range in line below, F-2
+           my $filename_with_regexp_escaped = $filename;
+            $filename_with_regexp_escaped =~ s/\-/\\-/g;
+            $filename_with_regexp_escaped =~ s/\[/\\[/g;
+            $filename_with_regexp_escaped =~ s/\]/\\]/g;
+            $line_desc =~ s/ of $filename_with_regexp_escaped$// if  
$filename eq $thisfile;

              push @prologue,
                  sprintf q{# %*s times%s%s at <a href="%s#%d">%s</a>%s},

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