Skip Menu |

This queue is for tickets about the Module-Runtime CPAN distribution.

Report information
The Basics
Id: 82642
Status: rejected
Priority: 0/
Queue: Module-Runtime

People
Owner: Nobody in particular
Requestors: xenoterracide [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: "argument is not a module name" improve error please
Date: Fri, 11 Jan 2013 16:13:52 -0600
To: bugs-module-runtime [...] rt.cpan.org
From: Caleb Cushing <xenoterracide [...] gmail.com>
argument is not a module name got this error message but I had no idea where it was coming from. I think confess might be good enough so that I can tell what line of my code is causing the problem, but that I can also see that it's coming from Class::Load and not a ->new statement if I'm doing load_class('Foo')->new; note: the argument type actually passed was an array ref, so obviously a problem with my code. I just want to be able to figure out where that was happening. -- Caleb Cushing http://xenoterracide.com
Subject: Re: [rt.cpan.org #82642] "argument is not a module name" improve error please
Date: Tue, 3 Dec 2013 20:36:00 +0000
To: Caleb Cushing via RT <bug-Module-Runtime [...] rt.cpan.org>
From: Zefram <zefram [...] fysh.org>
Caleb Cushing via RT wrote: Show quoted text
>got this error message but I had no idea where it was coming from.
For debugging you can use Carp::Always (or perform the $SIG{__DIE__} modification yourself) to get a confess-style stack trace from any exception. I'm not going to make Module::Runtime itself use confess, because convention is to have briefer error messages by default. I could possibly use croak instead of die, giving one line of error location, but in your case that would identify some line in Class::Load, not the location of the error in your code. Actually Class::Load calls check_module_name() before require_module(), which makes it more difficult: the line that calls check_module_name(), as it's performing an explicit check, isn't the line in error, so how far up the stack should one look? At best one can guess, which I'm not willing to do. This is a general problem with error handling in Perl, not at all specific to Module::Runtime. The problem arises from the history of using strings directly to represent errors, rather than structured objects that could squirrel away a usually-unseen stack trace. -zefram
Subject: Re: [rt.cpan.org #82642] "argument is not a module name" improve error please
Date: Tue, 3 Dec 2013 16:33:54 -0600
To: bug-Module-Runtime [...] rt.cpan.org
From: Caleb Cushing <xenoterracide [...] gmail.com>
On Tue, Dec 3, 2013 at 2:36 PM, Zefram via RT < bug-Module-Runtime@rt.cpan.org> wrote: Show quoted text
> This is a general problem with error handling in Perl, not at all specific > to Module::Runtime. The problem arises from the history of using strings > directly to represent errors, rather than structured objects that could > squirrel away a usually-unseen stack trace. >
the problem is a cultural one. History is irrelevant, if everyone just started using the relevant modules Stacktrace::Auto, or one of the modern exception objects... or wrote there own, this could go away very quickly (thank the gods, and the contributor, the next release of Moose will have exception objects) -- Caleb Cushing http://xenoterracide.com Calendar: https://www.google.com/calendar/embed?src=xenoterracide%40gmail.com&ctz=America/Chicago