Skip Menu |

This queue is for tickets about the Parse-CPAN-Authors CPAN distribution.

Report information
The Basics
Id: 36128
Status: resolved
Priority: 0/
Queue: Parse-CPAN-Authors

People
Owner: Nobody in particular
Requestors: ishigaki [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.26
Fixed in: (no value)



Subject: Email::Address is too strict to parse 01mailrc.txt
Hi. As of 2.26, Parse::CPAN::Authors uses Email::Address to parse email addresses listed in 01mailrc.txt, but, as not a few addresses listed there are not valid (to avoid spams), Email::Address refuses to parse them, and eventually Parse::CPAN::Authors spits an error such as Can't call method "phrase" on an undefined value at C:/Perl/site/lib/ Parse/CPAN/Authors.pm line 47. Here's a patch to fix this issue. Actually email addresses listed in 01mailrc.txt seem to have quite simple format: "name(white space)<address>". Name may have spaces, parentheses, and other special characters. Email also may have various characters including inner pairs of <>. So, probably it's best to parse them not by external modules but by Parse::CPAN::Authors (as it's too loose for a independent module). If you need some test to see what is happening now, try this script: #!perl use strict; use warnings; use Parse::CPAN::Authors; use CPAN::Config; use File::Spec::Functions qw( catfile ); my $cpan = Parse::CPAN::Authors->new( catfile( $CPAN::Config- Show quoted text
>{keep_source_where}, 'authors/01mailrc.txt.gz' ) );
foreach my $author ( $cpan->authors ) { print join "\n", $author->pauseid, $author->name, $author->email, "\n"; } Thanks, Kenichi Ishigaki aka charsbar
Subject: Parse-CPAN-Authors-2.26.patch
diff -ur Parse-CPAN-Authors-2.26/Makefile.PL Parse-CPAN-Authors-2.26-patched/Makefile.PL --- Parse-CPAN-Authors-2.26/Makefile.PL 2008-05-15 10:36:48.000000000 +0900 +++ Parse-CPAN-Authors-2.26-patched/Makefile.PL 2008-05-23 17:22:28.606125000 +0900 @@ -12,7 +12,6 @@ 'Test::Exception' => 0, 'IO::Zlib' => 0, 'Class::Accessor::Fast' => 0, - 'Email::Address' => 0 } ) ; diff -ur Parse-CPAN-Authors-2.26/lib/Parse/CPAN/Authors.pm Parse-CPAN-Authors-2.26-patched/lib/Parse/CPAN/Authors.pm --- Parse-CPAN-Authors-2.26/lib/Parse/CPAN/Authors.pm 2008-05-15 10:36:48.000000000 +0900 +++ Parse-CPAN-Authors-2.26-patched/lib/Parse/CPAN/Authors.pm 2008-05-23 17:25:31.518500000 +0900 @@ -1,6 +1,5 @@ package Parse::CPAN::Authors; use strict; -use Email::Address; use IO::Zlib; use Parse::CPAN::Authors::Author; use base qw( Class::Accessor::Fast ); @@ -42,11 +41,7 @@ my ( $alias, $pauseid, $long ) = split ' ', $line, 3; $long =~ s/^"//; $long =~ s/"$//; - - my $addr = ( Email::Address->parse($long) )[0]; - my $name = $addr->phrase; - my $email = $addr->address; - + my ($name, $email) = $long =~ /(.*) <(.+)>$/; my $a = Parse::CPAN::Authors::Author->new; $a->pauseid($pauseid); $a->name($name);
Gah sorry about about that. I've applied your patch and released to CPAN. Thanks! Leon