Description: Adds an exclude option to Makefile.PL for turning off components from the commandline.
Author: Chris Butler <chrisb@debian.org>
Last-Update: 2010-05-22

--- a/Makefile.PL
+++ b/Makefile.PL
@@ -59,10 +59,12 @@
 my $opt_yes = 0;
 my $opt_default = 0;
 my $opt_components;
+my $opt_exclude;
 GetOptions('strict-deps'  => \$opt_strictdeps,	# be strict about dependencies
 	   yes            => \$opt_yes,		# answer yes to all questions
    	   default        => \$opt_default,	# answer default to all questions
 	   'components=s' => \$opt_components,
+	   'exclude=s'	  => \$opt_exclude,
 	  );
 
 our $VERSION;
@@ -751,6 +753,20 @@
 END
       ;
 
+    my %by_name;
+    foreach (@opt_components) {
+        $by_name{$_->{name}} = $_;
+        $_->{exclude} = 0; # default if not mentioned
+    }
+
+    if (defined $opt_exclude) {
+        foreach (split /,/, $opt_exclude) {
+            my $i = $by_name{$_};
+            die "unknown component $_\n" if not $i;
+            $i->{exclude} = 1;
+        }
+    }
+
     my $width = 0;
     foreach my $info (@opt_components) {
 	my $w = length("$info->{blurb} ($info->{name})");
@@ -763,7 +779,7 @@
 	# Guess a default value for {install} based on whether
 	# prerequisites were found.
 	#
-	$info->{install} = $opt_yes || not $info->{missing};
+	$info->{install} = not $info->{exclude} && ($opt_yes || not $info->{missing});
 
 	print STDERR ($s, ' ' x (1 + $width - length $s),
 		      $info->{install} ? '[yes]' : '[no]',
