[Bps-public-commit] r9788 - bpsbuilder/BPB/lib/BPB/Source

sunnavy at bestpractical.com sunnavy at bestpractical.com
Sun Dec 2 11:37:06 EST 2007


Author: sunnavy
Date: Sun Dec  2 11:37:05 2007
New Revision: 9788

Modified:
   bpsbuilder/BPB/lib/BPB/Source/Base.pm

Log:
we need some hack for module's distribution name, now just added for lwp

Modified: bpsbuilder/BPB/lib/BPB/Source/Base.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Source/Base.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Source/Base.pm	Sun Dec  2 11:37:05 2007
@@ -12,6 +12,32 @@
 __PACKAGE__->mk_accessors(
     qw/source directory command download_directory follow mini_perl_version/);
 
+our %MODULE = ( '^(LWP
+|File::Listing
+|HTML::Form
+|HTTP::Cookies
+|HTTP::Cookies::Microsoft
+|HTTP::Cookies::Netscape
+|HTTP::Daemon 
+|HTTP::Date 
+|HTTP::Headers
+|HTTP::Headers::Auth
+|HTTP::Headers::ETag
+|HTTP::Headers::Util
+|HTTP::Message   
+|HTTP::Negotiate
+|HTTP::Request 
+|HTTP::Request::Common   
+|HTTP::Response  
+|HTTP::Status   
+|Net::HTTP
+|Net::HTTP::Methods          
+|Net::HTTP::NB
+|Net::HTTPS  
+|WWW::RobotRules
+|WWW::RobotRules::AnyDBM_File    
+)' => 'libwww-perl', );
+
 =head2 new
 
 =cut
@@ -61,7 +87,19 @@
                     delete $require->{$module};
                 }
                 else {
-                    unless ( grep /$module/, glob $self->directory ) {
+                    opendir my $dir, $self->directory;
+                    my @sources = readdir $dir;
+                    close $dir;
+                    my $name;
+
+                    for ( keys %MODULE ) {
+                        $name = $MODULE{$_} if $module =~ /$_/x;
+                    }
+
+                    $name ||= $module;
+                    $name =~ s/::/-/g;
+
+                    unless ( grep { /^$name/ } @sources ) {
                         my $cpan =
                           BPB::Source->new( %$self, source => $module );
                         $cpan->run();



More information about the Bps-public-commit mailing list