Revision: 1344
Author: [email protected]
Date: Sun Sep 12 05:01:01 2010
Log: Make 'file not found' messages related to Moose more self-explanatory.

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

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

=======================================
--- /trunk/lib/Devel/NYTProf/Reader.pm  Sun Sep 12 03:24:36 2010
+++ /trunk/lib/Devel/NYTProf/Reader.pm  Sun Sep 12 05:01:01 2010
@@ -11,7 +11,7 @@
 ###########################################################
 package Devel::NYTProf::Reader;

-our $VERSION = '4.04';
+our $VERSION = '4.05';

 use warnings;
 use strict;
@@ -389,17 +389,25 @@
$msg = "No source code available for non-file '$filestr'.\nYou probably need to use a more recent version of perl. See savesrc option in documentation.",
             }
             else {
+                $msg = "Unable to open '$filestr' for reading: $!";
+
+                # clarify some current Moose limitations XXX
+                if ($filestr =~ m!/(accessor .*) defined at /!) {
+ $msg = "Source for generated Moose $1 isn't available ($filestr: $!)";
+                }
+ elsif ($filestr =~ m!/(generated method \(unknown origin\))!) { + $msg = "Source for Moose $1 isn't available ($filestr: $!)";
+                }

# the report will not be complete, but this doesn't need to be fatal
                 my $hint = '';
- $hint = " Try running $0 in the same directory as you ran Devel::NYTProf, " + $hint .= " Try running $0 in the same directory as you ran Devel::NYTProf, "
                       . "or ensure \...@inc is correct."
                     if $filestr ne '-e'
                     and $filestr !~ m:^/:
and not our $_generate_report_inc_hint++; # only once

-                $msg = "Unable to open '$filestr' for reading: $!.$hint\n";
-                warn $msg
+                warn "$msg$hint\n"
unless our $_generate_report_filestr_warn->{$filestr}++; # only once per filestr

             }

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