Author: tim.bunce
Date: Sun Jun  7 12:04:41 2009
New Revision: 761

Modified:
    trunk/NYTProf.xs
    trunk/t/31-env.t

Log:
Only generate fake hint src line for -e & - cases.
Tweaked t/31-env.t


Modified: trunk/NYTProf.xs
==============================================================================
--- trunk/NYTProf.xs    (original)
+++ trunk/NYTProf.xs    Sun Jun  7 12:04:41 2009
@@ -2886,7 +2886,11 @@
          if (trace_level >= 4)
              warn("fid %d has %ld src lines", e->id, (long)lines);
          /* for perl 5.10.0 or 5.8.8 (or earlier) use_db_sub is needed to  
get src */
-        if (0 == lines && !use_db_sub) { /* give a hint */
+        /* give a hint for the common case */
+        if (0 == lines && !use_db_sub
+            &&   ( (e->key_len == 1 && strnEQ(e->key, "-",  1))
+                || (e->key_len == 2 && strnEQ(e->key, "-e", 2)) )
+        ) {
              av_store(src_av, 1, newSVpv("# source not available, try using  
use_db_sub=1 option.\n",0));
              lines = 1;
          }

Modified: trunk/t/31-env.t
==============================================================================
--- trunk/t/31-env.t    (original)
+++ trunk/t/31-env.t    Sun Jun  7 12:04:41 2009
@@ -32,11 +32,12 @@
          $got{$k} = $v;
      };

-    # Unload the class.
+    # (pretend to) Unload the class.
      delete $INC{'Devel/NYTProf/Core.pm'};

      # Test the class's parsing.
      local $ENV{NYTPROF} = $nytprof;
      require Devel::NYTProf::Core;
      is_deeply( \%got, $expected, "Parsed \$ENV{NYTPROF}='$nytprof' ok" );
-}
\ No newline at end of file
+}
+

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