develooper Front page | perl.perl5.porters | Postings from June 2009

Re: [perl #42329] Carp::croak() replace user error message by own

Thread Next
Alex Efros
June 29, 2009 03:13
Re: [perl #42329] Carp::croak() replace user error message by own
Message ID:

On Sun, Jun 28, 2009 at 07:02:40AM -0700, Bram via RT wrote:
> > Now shows:
> > 
> > Failed to load Carp::Heavy.  Consider adding use Carp::Heavy in your code.
> > Carp-Error: Can't locate Carp/   Too many open files at lib/ line 44.
> > Args: abc
> Any feedback on this? (patch is in RT)

I think that's wrong way to solve this issue, but it's better that nothing.

The problem is, right now all my scripts which doing heavy I/O contain line:

 require Carp::Heavy; #

and while I love to see this line removed from my scripts, with this patch
it still not possible.

Only I can do is try to explain again: error-reporting code like Carp MUST NOT
request additional resources - because if some error happens it's very
likely 'not enough resources' error and trying to get more resources just
to show error message just feels wrong.

I think correct solution will be to load Carp::Heavy together with Carp.
I see no reason to delay loading Carp::Heavy - it's very small and
shouldn't affect performance. Moreover, if you wanna speedup Carp loading,
then there a lot of other techniques - like moving POD to the bottom of
file under __END__. Also consider just moving Carp::Heavy content to Carp,
this shouldn't increase Carp module load time by any noticeable value and
also allow to do some code cleanup.

			WBR, Alex.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About