Subject: | Org::Element::Link bug in Org-Parser-0.27 |
Date: | Sun, 30 Dec 2012 08:24:58 +0200 |
To: | bug-Org-Parser [...] rt.cpan.org |
From: | Bernt Budde <bernt.budde [...] gmail.com> |
Hi,
Thanks for a cool module!
There is a small problem in the as_string() code in Org/Element/Link.pm
You haven't seen this because as_string() works when called for a
whole tree of Org::Element::Headline objects, since O::E::Headline has
the '_str' short cut. So as_string() won't be called for any Link.pm
in title or body.
Present code:
sub as_string {
my ($self) = @_;
return $self->_str if defined $self->_str;
join("",
"[",
"[", $self->link, "]",
(defined($self->description) && length($self->description) ?
("[", $self->description, "]") : ()),
"]");
}
# The problem is that description is an Org::Element::Text.
# Change to:
...
(defined($self->description) && length($self->description) ?
("[", $self->description->as_string, "]") : ()),
...
/Bernt Budde
PS
Sorry, almost morning here. Too tired to write a test for you. :-( :-)
DS
PPS
The module/version is Org-Parser-0.27
$ uname -a
Linux bughem 3.5.0-21-generic #32-Ubuntu SMP Tue Dec 11 18:51:59 UTC
2012 x86_64 x86_64 x86_64 GNU/Linux
$ perl -v
This is perl 5, version 16, subversion 2 (v5.16.2) built for x86_64-linux
Copyright 1987-2012, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
DS