Skip Menu |

This queue is for tickets about the Org-Parser CPAN distribution.

Report information
The Basics
Id: 100553
Status: resolved
Priority: 0/
Queue: Org-Parser

People
Owner: Nobody in particular
Requestors: lbmoore [...] hethcote.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Exiting subroutine via next
Date: Tue, 25 Nov 2014 12:57:42 -0700 (MST)
To: bug-Org-Parser [...] rt.cpan.org
From: "Louis B. Moore" <lbmoore [...] hethcote.com>
I have some code that gets fed an Org::Element::Headline and does: $head{'has_id'} = $hl->get_property('ID',undef); $head{'has_cat'} = $hl->get_property('CATEGORY','1'); When asking for the parent search for the has_cat value, Org::Element:Headline dies with: Exiting subroutine via next at /usr/local/share/perl/5.20.1/Org/Element/Headline.pm line 224. Which turns out to be because the parent is an Org::Document and triggers the next as below if ($p && $search_parent) { !---> next unless $p->isa('Org::Element::Headline'); my $res = $p->get_property($name, 1); return $res if defined $res; } Louis
On Tue Nov 25 14:58:01 2014, lbmoore@hethcote.com wrote: Show quoted text
> > I have some code that gets fed an Org::Element::Headline and does: > > $head{'has_id'} = $hl->get_property('ID',undef); > $head{'has_cat'} = $hl->get_property('CATEGORY','1'); > > When asking for the parent search for the has_cat value, > Org::Element:Headline dies with: > > Exiting subroutine via next at > /usr/local/share/perl/5.20.1/Org/Element/Headline.pm line 224. > > Which turns out to be because the parent is an Org::Document and triggers > the next as below > > if ($p && $search_parent) { > !---> next unless $p->isa('Org::Element::Headline'); > my $res = $p->get_property($name, 1); > return $res if defined $res; > } > > > Louis
Could you try if the newly released 0.42 fix your problem? Regards,
Subject: Re: [rt.cpan.org #100553] Exiting subroutine via next
Date: Tue, 25 Nov 2014 20:37:57 -0700 (MST)
To: steven haryanto via RT <bug-Org-Parser [...] rt.cpan.org>
From: "Louis B. Moore" <lbmoore [...] hethcote.com>
On Tue, 25 Nov 2014, steven haryanto via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=100553 > > > > Could you try if the newly released 0.42 fix your problem? > > Regards, > >
No, actually it falls into an endless loop. in its simplest form the subroutine headline: sub headline { my $hl = shift; $DB::single=1; my %head; $head{'has_cat'} = $hl->get_property('CATEGORY','1'); return; } $ perl -d km-test-03.pl ... DB<1> s main::headline(km-test-03.pl:226): my %head; DB<1> main::headline(km-test-03.pl:240): $head{'has_cat'} = $hl->get_property('CATEGORY','1'); DB<1> Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:216): 216: my ($self, $name, $search_parent) = @_; DB<1> Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:218): 218: my $p = $self->parent; DB<1> Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:220): 220: my $pd = $self->get_drawer("PROPERTIES"); DB<1> p $self Org::Element::Headline=HASH(0x386b5f0)Headline DB<2> p $name CATEGORY DB<3> p $search_parent 1 ... DB<4> Org::Element::children_as_string(/usr/local/share/perl/5.20.1/Org/Element.pm:22): 22: return "" unless $self->children; DB<4> Log::Any::Adapter::Null::CODE(0x3119030)(/usr/local/share/perl/5.20.1/Log/Any/Adapter/Null.pm:29): 29: *{ __PACKAGE__ . "::$method" } = sub { return undef }; DB<4> Org::Element::Headline::get_drawer(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:208): 208: next unless ($d->isa('Org::Element::Drawer') 209: && $d->name eq $wanted_drawer_name 210: && $d->properties); DB<4> Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:221): 221: return $pd->properties->{$name} if ($pd and defined $pd->properties->{$name}); DB<4> Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:223): 223: if ($p && $search_parent) { DB<4> Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:224): 224: while ($p) { DB<4> Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:225): 225: next unless $p->isa('Org::Element::Headline'); DB<4> Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:225): 225: next unless $p->isa('Org::Element::Headline'); DB<4> p $p Org::Document=HASH(0x365efc0) It never exits line 225 Louis
Could you provide the km-test-03.pl script (or a simplified form of it) to test this? On Tue Nov 25 22:38:08 2014, lbmoore@hethcote.com wrote: Show quoted text
> > > On Tue, 25 Nov 2014, steven haryanto via RT wrote: >
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=100553 > > > > > > > Could you try if the newly released 0.42 fix your problem? > > > > Regards, > > > >
> > No, actually it falls into an endless loop. > > in its simplest form the subroutine headline: > > sub headline { > > my $hl = shift; > $DB::single=1; > my %head; > $head{'has_cat'} = $hl->get_property('CATEGORY','1'); > > return; > > } > > $ perl -d km-test-03.pl > > ... > > DB<1> s > > main::headline(km-test-03.pl:226): my %head; > DB<1> > main::headline(km-test-03.pl:240): $head{'has_cat'} = > $hl->get_property('CATEGORY','1'); > DB<1> > Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:216): > 216: my ($self, $name, $search_parent) = @_; > DB<1> > Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:218): > 218: my $p = $self->parent; > DB<1> > Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:220): > 220: my $pd = $self->get_drawer("PROPERTIES"); > DB<1> p $self > Org::Element::Headline=HASH(0x386b5f0)Headline > DB<2> p $name > CATEGORY > DB<3> p $search_parent > 1 > > ... > > DB<4> > Org::Element::children_as_string(/usr/local/share/perl/5.20.1/Org/Element.pm:22): > 22: return "" unless $self->children; > DB<4> > Log::Any::Adapter::Null::CODE(0x3119030)(/usr/local/share/perl/5.20.1/Log/Any/Adapter/Null.pm:29): > 29: *{ __PACKAGE__ . "::$method" } = sub { return undef }; > DB<4> > Org::Element::Headline::get_drawer(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:208): > 208: next unless ($d->isa('Org::Element::Drawer') > 209: && $d->name eq > $wanted_drawer_name > 210: && $d->properties); > DB<4> > Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:221): > 221: return $pd->properties->{$name} if ($pd and defined > $pd->properties->{$name}); > DB<4> > Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:223): > 223: if ($p && $search_parent) { > DB<4> > Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:224): > 224: while ($p) { > DB<4> > Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:225): > 225: next unless $p->isa('Org::Element::Headline'); > DB<4> > Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:225): > 225: next unless $p->isa('Org::Element::Headline'); > DB<4> p $p > Org::Document=HASH(0x365efc0) > > > It never exits line 225 > > > > > Louis
Subject: Re: [rt.cpan.org #100553] Exiting subroutine via next
Date: Sun, 30 Nov 2014 16:42:12 -0700 (MST)
To: Perl Ancar via RT <bug-Org-Parser [...] rt.cpan.org>
From: "Louis B. Moore" <lbmoore [...] hethcote.com>
Attached are a short script that hits the bug, and a short document in which the bug is hit; Louis On Sun, 30 Nov 2014, Perl Ancar via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=100553 > > > Could you provide the km-test-03.pl script (or a simplified form of it) to test this? > > On Tue Nov 25 22:38:08 2014, lbmoore@hethcote.com wrote:
>> >> >> On Tue, 25 Nov 2014, steven haryanto via RT wrote: >>
>>> <URL: https://rt.cpan.org/Ticket/Display.html?id=100553 > >>> >>> >>> Could you try if the newly released 0.42 fix your problem? >>> >>> Regards, >>> >>>
>> >> No, actually it falls into an endless loop. >> >> in its simplest form the subroutine headline: >> >> sub headline { >> >> my $hl = shift; >> $DB::single=1; >> my %head; >> $head{'has_cat'} = $hl->get_property('CATEGORY','1'); >> >> return; >> >> } >> >> $ perl -d km-test-03.pl >> >> ... >> >> DB<1> s >> >> main::headline(km-test-03.pl:226): my %head; >> DB<1> >> main::headline(km-test-03.pl:240): $head{'has_cat'} = >> $hl->get_property('CATEGORY','1'); >> DB<1> >> Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:216): >> 216: my ($self, $name, $search_parent) = @_; >> DB<1> >> Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:218): >> 218: my $p = $self->parent; >> DB<1> >> Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:220): >> 220: my $pd = $self->get_drawer("PROPERTIES"); >> DB<1> p $self >> Org::Element::Headline=HASH(0x386b5f0)Headline >> DB<2> p $name >> CATEGORY >> DB<3> p $search_parent >> 1 >> >> ... >> >> DB<4> >> Org::Element::children_as_string(/usr/local/share/perl/5.20.1/Org/Element.pm:22): >> 22: return "" unless $self->children; >> DB<4> >> Log::Any::Adapter::Null::CODE(0x3119030)(/usr/local/share/perl/5.20.1/Log/Any/Adapter/Null.pm:29): >> 29: *{ __PACKAGE__ . "::$method" } = sub { return undef }; >> DB<4> >> Org::Element::Headline::get_drawer(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:208): >> 208: next unless ($d->isa('Org::Element::Drawer') >> 209: && $d->name eq >> $wanted_drawer_name >> 210: && $d->properties); >> DB<4> >> Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:221): >> 221: return $pd->properties->{$name} if ($pd and defined >> $pd->properties->{$name}); >> DB<4> >> Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:223): >> 223: if ($p && $search_parent) { >> DB<4> >> Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:224): >> 224: while ($p) { >> DB<4> >> Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:225): >> 225: next unless $p->isa('Org::Element::Headline'); >> DB<4> >> Org::Element::Headline::get_property(/usr/local/share/perl/5.20.1/Org/Element/Headline.pm:225): >> 225: next unless $p->isa('Org::Element::Headline'); >> DB<4> p $p >> Org::Document=HASH(0x365efc0) >> >> >> It never exits line 225 >> >> >> >> >> Louis
> > > > >

Message body is not shown because sender requested not to inline it.

Message body is not shown because sender requested not to inline it.

在2014-十一月-30 18:42:25 星期日时,lbmoore@hethcote.com写到: Show quoted text
> > > Attached are a short script that hits the bug, and a short document in > which the bug is hit; > > > Louis
OK, I think I've fixed this now in 0.43. BTW, in your sample script and data, if you expect $headline->get_property("CATEGORY", 1) you will still get undef because there is no properties drawer or document-wide properties with that name. However, $headline->get_property("CLASS", 1) will return "Index".
Subject: Re: [rt.cpan.org #100553] Exiting subroutine via next
Date: Thu, 4 Dec 2014 06:54:55 -0700 (MST)
To: Perl Ancar via RT <bug-Org-Parser [...] rt.cpan.org>
From: "Louis B. Moore" <lbmoore [...] hethcote.com>
Yes, it is working. My mistake on CATEGORY. It is a setting, even though I have been using it as a document property. I think I'd be wise to decide on a property name to use in place of the CATEGORY setting. Thank you, Louis On Mon, 1 Dec 2014, Perl Ancar via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=100553 > > > 在2014-十一月-30 18:42:25 星期日时,lbmoore@hethcote.com写到:
>> >> >> Attached are a short script that hits the bug, and a short document in >> which the bug is hit; >> >> >> Louis
> > OK, I think I've fixed this now in 0.43. BTW, in your sample script and > data, if you expect $headline->get_property("CATEGORY", 1) you will > still get undef because there is no properties drawer or document-wide > properties with that name. However, $headline->get_property("CLASS", 1) > will return "Index". > >