develooper Front page | perl.perl5.porters | Postings from July 2016

[perl #36094] Wrong line number for FILEHANDLE reported by Xref(Xref.pm V1.01)

Thread Previous
From:
Father Chrysostomos via RT
Date:
July 8, 2016 04:42
Subject:
[perl #36094] Wrong line number for FILEHANDLE reported by Xref(Xref.pm V1.01)
Message ID:
rt-4.0.18-30189-1467952958-396.36094-15-0@perl.org
On Sat Nov 12 06:54:33 2011, jkeenan wrote:
> On Thu Jun 02 09:44:48 2005, root@millenium.ro wrote:
> > 
> > This is a bug report for perl from g.badoi@millenium.ro,
> > generated with the help of perlbug 1.34 running under perl v5.8.2.
> > 
> > 
> > -----------------------------------------------------------------
> > Xref.pm (v 1.01) detects wrong line number for filehandles is some
> > circumstances,
> > as below:
> > 
> > __________________________________________
> > 
> > #!/usr/bin/perl -w
> > 
> > my $a = 1;
> > 
> > if ($a) {
> >     print STDOUT "This line is misreported\n";
> > }
> > __________________________________________
> > 
> > "perl -MO=Xref bug.pl >buf.xref" generates:
> > 
> > __________________________________________
> > 
> > File t.pl
> ...
> >   Subroutine (main)
> >     Package (lexical)
> >       $a                i3, 5
> >     Package main
> >       *STDOUT           5
> > ___________________________________________
> > 
> > reporting STDOUT as used at line 5 instead of line 6.
> > 
> 
> I'm not sure this should be considered to be a bug.  My (limited)
> understanding of the B::* is that they're not necessarily expected to
> account for all possible variations of whitespace.  Absent whitespace,
> 
>   if ($alpha) {
>       print STDOUT "This line is misreported\n";
>   }
> 
> ... is equivalent to:
> 
>   if ($alpha) { print STDOUT "This line is misreported\n"; }

What’s actually happening is that B::Xref is ignoring nulled cops, which is not terribly surprising, as B did not provide the cop fields for those until I added the feature, in 5.22 iirc.

So yes, this is fixable.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=36094

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About