Re: [rt.cpan.org #74389] Pod::Simple::Pullparser get_title should ignore X<...>

[email protected] (Karl Williamson)
Newsgroups perl.pod-people
Message-ID <[email protected]>
On 03/02/2012 12:34 AM, David E. Wheeler wrote:
> On Jan 29, 2012, at 3:15 PM, David E. Wheeler wrote:
>
>>> And "NAME" and not "NAME "
>>>
>>> It should probably not just become an empty string, but it should be collapse
>>> whitespace around it, so pathological cases like:
>>>
>>> =head1 NAME X<foo>  THIS X<bar>  TUNE
>>> X<baz>
>>>
>>> ...should be "NAME THIS TUNE"
>>>
>>> But in the simpler case, I think that "NAME" and not "NAME " is actually likely
>>> to come up.
>>
>> Okay, so if I follow this thread correctly, the upshot is that:
>>
>> • Pod::Simple::HTML needs to be fixed so that it does not include the contents of X<>
>> • The parser overall should be adjusted to remove superfluous whitespace
>
> FWIW, I could use confirmation on this.

What sort of confirmation do you need?  I agree with the two bulleted 
items, if you're looking for that kind of confirmation.
>
> Meanwhile, here's a test case showing the original bug with PullParser:
>
> diff --git a/t/pulltitl.t b/t/pulltitl.t
> index 22934f5..a846048 100644
> --- a/t/pulltitl.t
> +++ b/t/pulltitl.t
> @@ -7,7 +7,7 @@ BEGIN {
>
>   use strict;
>   use Test;
> -BEGIN { plan tests =>  116 };
> +BEGIN { plan tests =>  117 };
>
>   #use Pod::Simple::Debug (5);
>
> @@ -408,6 +408,13 @@ ok( $t&&  $t->type eq 'start'&&  $t->tagname, 'Document' );
>   }
>
>   ###########################################################################
> +print "# Testing a title with an X<>, at line ", __LINE__, "\n";
> +my $p = Pod::Simple::PullParser->new;
> +$p->set_source( \qq{\n=head1 NAME\nX<Some entry>\n} );
> +
> +ok $p->get_title(), 'NAME';
> +
> +###########################################################################
>   ###########################################################################
>
>
>
> That fails with:
>
> not ok 116
> # Test 116 got: "NAME Some entry" (t/pulltitl.t at line 415)
> #     Expected: "NAME"
> #  t/pulltitl.t line 415 is: ok $p->get_title(), 'NAME';
>
> So it seems as though X<>  issues my be all over the place, eh?
>
> Best,
>
> David
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.