From: Dave Rolsky Date: Sat, 21 Feb 2009 19:15:45 +0000 (+0000) Subject: A hack I think will fix the formatting on search.cpan. X-Git-Tag: 0.71_01~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5547fba771baa52a04ec8dcb3673032ed4c1c0cc;p=gitmo%2FMoose.git A hack I think will fix the formatting on search.cpan. search.cpan seems to dislike a =begin block that isn't a single word. Hopefully it accepts dashes. If search.cpan wasn't a fucking closed source app I could actually look at the code and figure this out. --- diff --git a/author/extract-inline-tests b/author/extract-inline-tests index d91fa43..77fb246 100755 --- a/author/extract-inline-tests +++ b/author/extract-inline-tests @@ -27,9 +27,10 @@ use warnings; \n=for[ \t]+example[ \t]+end\s*? # ... until the =for example end (?:\n|$) # ... at the end of file or a newline | # OR - =begin[ \t]+(?:test|testing)\b # ... when we find a =begin test or testing - .*? # ... and keep capturing - \n=end[ \t]+(?:test|testing)\s*? # ... until an =end tag + =begin[ \t]+(?:test|testing)(?:-SETUP)? # ... when we find a =begin test or testing + .*? # ... and keep capturing + \n=end[ \t]+(?:test|testing)(?:-SETUP)? # ... until an =end tag + .*? (?:\n|$) # ... at the end of file or a newline ) # ... and stop capturing /isx; @@ -42,10 +43,14 @@ use warnings; # A hack to turn the SYNOPSIS into something Test::Inline # doesn't barf on - if ( $elt =~ s/=head1[ \t]+SYNOPSIS/=begin testing SETUP\n\n{/ ) { - $elt .= "}\n\n=end testing SETUP"; + if ( $elt =~ s/=head1[ \t]+SYNOPSIS/=begin testing-SETUP\n\n{/ ) { + $elt .= "}\n\n=end testing-SETUP"; } + # It seems like search.cpan doesn't like a name with + # spaces after =begin. bleah, what a mess. + $elt =~ s/testing-SETUP/testing SETUP/g; + push @elements, $elt; } diff --git a/lib/Moose/Cookbook/Basics/Recipe4.pod b/lib/Moose/Cookbook/Basics/Recipe4.pod index 6e150f5..b771262 100644 --- a/lib/Moose/Cookbook/Basics/Recipe4.pod +++ b/lib/Moose/Cookbook/Basics/Recipe4.pod @@ -1,7 +1,7 @@ =pod -=begin testing SETUP +=begin testing-SETUP BEGIN { eval 'use Regexp::Common; use Locale::US;'; @@ -12,7 +12,7 @@ BEGIN { } } -=end testing +=end testing-SETUP =head1 NAME diff --git a/lib/Moose/Cookbook/Basics/Recipe5.pod b/lib/Moose/Cookbook/Basics/Recipe5.pod index 2dee852..dd4120c 100644 --- a/lib/Moose/Cookbook/Basics/Recipe5.pod +++ b/lib/Moose/Cookbook/Basics/Recipe5.pod @@ -1,7 +1,7 @@ =pod -=begin testing SETUP +=begin testing-SETUP BEGIN { eval 'use HTTP::Headers; use Params::Coerce; use URI;'; @@ -12,7 +12,7 @@ BEGIN { } } -=end testing +=end testing-SETUP =head1 NAME diff --git a/lib/Moose/Cookbook/Extending/Recipe3.pod b/lib/Moose/Cookbook/Extending/Recipe3.pod index 86aeec6..13bb2d0 100644 --- a/lib/Moose/Cookbook/Extending/Recipe3.pod +++ b/lib/Moose/Cookbook/Extending/Recipe3.pod @@ -1,7 +1,7 @@ =pod -=begin testing SETUP +=begin testing-SETUP BEGIN { eval 'use Test::Warn 0.11;'; @@ -12,7 +12,7 @@ BEGIN { } } -=end testing +=end testing-SETUP =head1 NAME diff --git a/lib/Moose/Cookbook/Roles/Recipe3.pod b/lib/Moose/Cookbook/Roles/Recipe3.pod index c6faf8e..3c18955 100644 --- a/lib/Moose/Cookbook/Roles/Recipe3.pod +++ b/lib/Moose/Cookbook/Roles/Recipe3.pod @@ -2,7 +2,7 @@ package Moose::Cookbook::Roles::Recipe3; =pod -=begin testing SETUP +=begin testing-SETUP { # Not in the recipe, but needed for writing tests. @@ -23,7 +23,7 @@ package Moose::Cookbook::Roles::Recipe3; ); } -=end testing +=end testing-SETUP =head1 NAME