On Thu, Jan 29, 2004 at 04:41:41PM -0800, Daisuke Maki <[EMAIL PROTECTED]> wrote: > > It was really annoying me that parsers based on DT::F::Builder would by > default report a parse failure as being in DT::F::B::Parser. > > I'd like the error message to tell me where in the calling script it > failed, so I'd like to introduce this patch. > > Index: lib/DateTime/Format/Builder.pm > =================================================================== > RCS file: > /cvsroot/perl-date-time/modules/DateTime-Format-Builder/lib/DateTime/F > ormat/Builder.pm,v > retrieving revision 1.35 > diff -d -u -r1.35 Builder.pm > --- lib/DateTime/Format/Builder.pm 26 Jan 2004 18:46:45 -0000 1.35 > +++ lib/DateTime/Format/Builder.pm 30 Jan 2004 00:37:34 -0000 > @@ -200,6 +200,13 @@ > sub on_fail > { > my ($class, $input) = @_; > + > + my $i = 0; > + while (my ($pkg) = caller($i++)) { > + last if ($pkg ne 'DateTime::Format::Builder' && > + $pkg !~ /^DateTime::Format::Builder::Parser/); > + } > + local $Carp::CarpLevel = $i; > croak "Invalid date format: $input"; > } >
CarpLevel is (at least semi-) deprecated. Consider using @CARP_NOT.