Wrong line number in error message

Bug #57061 reported by Nikolaus Rath
2
Affects Status Importance Assigned to Milestone
perl (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

nokile:~/Work$ ./bug.pl
Can't call method "type" on unblessed reference at ./bug.pl line 18.

but the error is in line 27.

Revision history for this message
Steve Peters (steve-fisharerojo) wrote : Re: [Bug 57061] $p->{"type"} tries to call a method named type

On Mon, Aug 21, 2006 at 08:22:37AM -0000, Nikolaus Rath wrote:
> Public bug reported:
>
> DB<1> s
> main::valid_answer(/home/nikratio/Projekte/Archiver/Archiver.pm:314):
> 314: if($p->{"type"} eq "string") {
> DB<1> x $p
> 0 HASH(0x892a01c)
> 'default' => 'never'
> 'emptyok' => 1
> 'query' => 'Expiration date'
> 'type' => 'timeoff'
> DB<2> x $p->{"type"}
> 0 'timeoff'
> DB<3> s
> main::(/home/nikratio/bin/aadd:94):
> 94: if($@) {
> DB<3> x $@
> 0 'Can\'t call method "type" on unblessed reference at /home/nikratio/Projekte/Archiver/Archiver.pm line 314, <STDIN> line 10.
> '
> DB<4>
>
> ** Affects: perl (Ubuntu)
> Importance: Untriaged
> Status: Unconfirmed
>
> --
> $p->{"type"} tries to call a method named type

My guess would be that somewhere in the object hierarchy, something has
an AUTOLOAD defined. This is the expected behavior in that case.

Steve Peters
<email address hidden>

Revision history for this message
Nikolaus Rath (nikratio) wrote : Re: [Bug 57061] Re: [Bug 57061] $p->{"type"} tries to call a method named type

Steve Peters <email address hidden> writes:
>> $p->{"type"} tries to call a method named type
>
> My guess would be that somewhere in the object hierarchy, something has
> an AUTOLOAD defined. This is the expected behavior in that case.

Could you elaborate on that a little bit more? I thought autoloading
only takes place if an undefined subroutine is called. But here there
should be no call in the first place. Also, why can I access
$p->{type} in the debugger without an error?

Thanks,

  --Nikolaus

Revision history for this message
Nikolaus Rath (nikratio) wrote :
description: updated
Revision history for this message
Steve Peters (steve-fisharerojo) wrote : Re: [Bug 57061] Re: Wrong line number in error message

On Tue, Sep 05, 2006 at 06:44:30PM -0000, Nikolaus Rath wrote:
>
> ** Summary changed:
>
> - $p->{"type"} tries to call a method named type
> + Wrong line number in error message
>
> ** Description changed:
>
> - DB<1> s
> - main::valid_answer(/home/nikratio/Projekte/Archiver/Archiver.pm:314):
> - 314: if($p->{"type"} eq "string") {
> - DB<1> x $p
> - 0 HASH(0x892a01c)
> - 'default' => 'never'
> - 'emptyok' => 1
> - 'query' => 'Expiration date'
> - 'type' => 'timeoff'
> - DB<2> x $p->{"type"}
> - 0 'timeoff'
> - DB<3> s
> - main::(/home/nikratio/bin/aadd:94):
> - 94: if($@) {
> - DB<3> x $@
> - 0 'Can\'t call method "type" on unblessed reference at /home/nikratio/Projekte/Archiver/Archiver.pm line 314, <STDIN> line 10.
> - '
> - DB<4>
> + nokile:~/Work$ ./bug.pl
> + Can't call method "type" on unblessed reference at ./bug.pl line 18.
> +
> + but the error is in line 27.
>
> ** Attachment added: "testcase"
> http://librarian.launchpad.net/4136476/bug.pl
>

Unfortunately, I don't believe this bug will ever be fixed. The problem
is how Perl code is represented internally by the perl executable. This
is because the optree does not contain line number information on the
elsif lines. It is not a trivial problem and would like cause
performance to suffer it is fixed. See the Perl bug queue for more
information on this problem at <http://rt.perl.org/rt3/Ticket/Display.html?id=37302>.

Steve Peters
<email address hidden>

Changed in perl:
status: Unconfirmed → Confirmed
Revision history for this message
Adam Niedling (krychek) wrote :

The status of the upstream bug is 'resolved' so I'm closing this bug. Please reopen if this is still an issue for you after all.

Changed in perl:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.