Skip Menu |

This queue is for tickets about the cpan2rpm CPAN distribution.

Report information
The Basics
Id: 16954
Status: new
Priority: 0/
Queue: cpan2rpm

People
Owner: Nobody in particular
Requestors: sherwin [...] saturn.emc.com.ph
Cc:
AdminCc:

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



Subject: parsed description still contains POD commands (=over,=item, etc)
Using cpan2rpm v2.028, if you issue cpan2rpm http://search.cpan.org/CPAN/authors/id/G/GA/GAAS/libwww-perl-5.805.tar.gz POD commands (like =over and =item) are still visible on the %description section of the rpm specfile. Also, "None." would appear if you try it on the latest CGI tar ball. A proposed patch (based on Pod::Parser) is attached. HTH Sherwin Daganato
diff -Naur cpan2rpm-2.028.orig/cpan2rpm cpan2rpm-2.028/cpan2rpm --- cpan2rpm-2.028.orig/cpan2rpm 2005-06-18 05:06:54.000000000 +0000 +++ cpan2rpm-2.028/cpan2rpm 2006-01-07 15:30:05.000000000 +0000 @@ -53,6 +53,55 @@ # --- support functionality --------------------------------------------------- +BEGIN { + package MyPod::Text; + our @ISA = qw(Pod::Text); + + sub new { + my $class = shift; + my $self = $class->SUPER::new(indent => 0); + $self->{output_string} = undef; + return $self; + } + + sub parse_from_string { + my $self = shift; + my $pod = shift; + $self->{output_string} = shift; # scalar ref + my $paragraph = ''; + while($pod =~ /([^\n\r]*\r?\n)/g ) { + next unless (defined $1 && length (my $textline = $1)); + + if ((! length $paragraph) && ($textline =~ /^==/)) { + ## '==' denotes a one-line command paragraph + $paragraph = $textline; + } + else { + ## Append this line to the current paragraph + $paragraph .= $textline; + } + + ## See if this line is blank and ends the current paragraph. + ## If it isnt, then keep iterating until it is. + next unless (($textline =~ /^([^\S\r\n]*)[\r\n]*$/) + && (length $paragraph)); + + ## Now process the paragraph + $self->parse_paragraph($paragraph); + $paragraph = ''; + } + + ## Dont forget about the last paragraph in the file + if (length $paragraph) { + $self->parse_paragraph($paragraph); + } + } + + sub output { + $_[1] =~ tr/\01/ /; ${ $_[0]->{output_string} } .= $_[1]; + } + } + END { chdir $CWD; return print("$VERSION\n") if $VX; @@ -522,13 +571,14 @@ $meta{DESCRIPTION} ||= ""; if (!$meta{DESCRIPTION} && $from) { - if ($from =~ /=head\d\s+DESCRIPTION\s+(.*?)=(head|cut)/ism) { - $meta{DESCRIPTION} = $pod->interpolate($1) + if ($from =~ /=head(\d)\s+DESCRIPTION\s+(.*?)=(?:head\1|cut)/ism) { + MyPod::Text->new()->parse_from_string($2, \$meta{DESCRIPTION}); } - elsif ($from =~ /=head\d\s+SYNOPSIS\s+(.*?)=(head|cut)/ism) { - $meta{DESCRIPTION} = $pod->interpolate($1) + elsif ($from =~ /=head(\d)\s+SYNOPSIS\s+(.*?)=(?:head\1|cut)/ism) { + MyPod::Text->new()->parse_from_string($2, \$meta{DESCRIPTION}); } } + $meta{DESCRIPTION} =~ s/%/%%/g; # escape percent signs $info->{author} ||= $meta{AUTHOR} || "";