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

Re: [perl #133239] Very misleading line number for warnings in somecases

Thread Previous
Rocky Bernstein
June 20, 2018 14:07
Re: [perl #133239] Very misleading line number for warnings in somecases
Message ID:
On Wed, Jun 20, 2018 at 7:28 AM, Dave Mitchell <> wrote:

> On Wed, Jun 20, 2018 at 06:15:25AM -0400, Rocky Bernstein wrote:
> > Apparently, I wasn't clear in describing what I was proposing. There were
> > two parts to what I wrote:
> >
> >
> >    1. A sugg[e]stion to add some sort of mechanism whereby a user can
> write a
> >    custom error/warning handler, and then
> >    2. a suggestiion on how to use this to provide a better error location
> >    indication
> >
> > Let me elaborate a little on 1.
> >
> > Currently Perl has an END block which is close, but has a couple of
> > problems here.
> I don't understand what END blocks have to do with this.
> On the other hand, the pre-existing $SIG{__WARN__} and $SIG{__DIE__} sound
> close to what you want. The main issue seems that the value of PL_op is
> not available at the time the handler is called, even if the handler is an
> XS sub  (PL_op gets saved, then set to a faked up OP_ENTERSUB for the
> purposes of calling the handler).
> Perhaps perl should set an interpreter variable, PL_warn_err_op, say,
> before
> calling the warn/die hook?

That would be fantastic.

> PS I'm assuming you're not suggesting that perl itself does (2)?

I don't want to get sidetracked on this. More important to the community
should be fact that this bug has been around for 16 years and honestly
probably won't be addressed soon. Therefore addressing (1) provides users
with at least an alternative remedy.

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