Author: dagolden
Date: Fri Nov 13 05:41:16 2009
New Revision: 13499

Modified:
   Module-Build/trunk/Changes
   Module-Build/trunk/lib/Module/Build/PodParser.pm
   Module-Build/trunk/t/pod_parser.t

Log:
find author and abstract despite POD header case

Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes  (original)
+++ Module-Build/trunk/Changes  Fri Nov 13 05:41:16 2009
@@ -13,6 +13,9 @@
 
  Bug fixes:
 
+ - Auto-detection of abstract and author fixed for mixed-case POD headers
+   (RT#51117) [David Wheeler]
+
  - resume() was not restoring additions to @INC added in Build.PL
    (RT#50145) [David Golden]
 

Modified: Module-Build/trunk/lib/Module/Build/PodParser.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/PodParser.pm    (original)
+++ Module-Build/trunk/lib/Module/Build/PodParser.pm    Fri Nov 13 05:41:16 2009
@@ -42,7 +42,7 @@
   
   my @author;
   while (<$fh>) {
-    next unless /^=head1\s+AUTHORS?/ ... /^=/;
+    next unless /^=head1\s+AUTHORS?/i ... /^=/;
     next if /^=/;
     push @author, $_ if /\@/;
   }
@@ -92,10 +92,10 @@
   my ($self, $text) = @_;
   $text =~ s/^\s+//;
   $text =~ s/\s+$//;
-  if ($self->{_head} eq 'NAME') {
+  if (uc $self->{_head} eq 'NAME') {
     my ($name, $abstract) = split( /\s+-\s+/, $text, 2 );
     $self->{abstract} = $abstract;
-  } elsif ($self->{_head} =~ /^AUTHORS?$/) {
+  } elsif ($self->{_head} =~ /^AUTHORS?$/i) {
     push @{$self->{author}}, $text if $text =~ /\@/;
   }
 }

Modified: Module-Build/trunk/t/pod_parser.t
==============================================================================
--- Module-Build/trunk/t/pod_parser.t   (original)
+++ Module-Build/trunk/t/pod_parser.t   Fri Nov 13 05:41:16 2009
@@ -2,7 +2,7 @@
 
 use strict;
 use lib 't/lib';
-use MBTest tests => 6;
+use MBTest tests => 9;
 
 blib_load('Module::Build::PodParser');
 
@@ -65,3 +65,26 @@
 }
 
 
+{
+    # Try again with mixed-case =head1s.
+  untie *FH;
+  tie *FH, 'IO::StringBased', <<'EOF';
+=head1 Name
+
+Foo::Bar - Perl extension for blah blah blah
+
+=head1 Author
+
+C<Foo::Bar> was written by Engelbert Humperdinck I<E<lt>[email protected]<gt>> 
in 2004.
+
+Home page: http://example.com/~eh/
+
+=cut
+EOF
+
+  my $pp = Module::Build::PodParser->new(fh => \*FH);
+  ok $pp, 'object created';
+
+  is $pp->get_author->[0], 'C<Foo::Bar> was written by Engelbert Humperdinck 
I<E<lt>[email protected]<gt>> in 2004.', 'author';
+  is $pp->get_abstract, 'Perl extension for blah blah blah', 'abstract';
+}

Reply via email to