Permalink
Browse files

Made mixin idempotent

  • Loading branch information...
1 parent 268f3a9 commit ff1634c31255e0b4fc0f61772cbd87187b0435bd @Leont committed Aug 2, 2010
Showing with 11 additions and 10 deletions.
  1. +11 −10 inc/Library/Build.pm
View
21 inc/Library/Build.pm
@@ -432,6 +432,17 @@ sub register_paths {
return;
}
+sub mixin {
+ my ($self, @modules) = @_;
+ for my $module (@modules) {
+ next if $self->{mixed_in}{$module}++;
+ load($module);
+ my $method = "$module\::mixin";
+ $self->$method();
+ }
+ return;
+}
+
sub dispatch {
my ($self, @action_names) = @_;
croak 'No action defined' if not @action_names;
@@ -458,14 +469,4 @@ sub dispatch_default {
return;
}
-sub mixin {
- my ($self, @modules) = @_;
- for my $module (@modules) {
- load($module);
- my $method = "$module\::mixin";
- $self->$method();
- }
- return;
-}
-
1;

0 comments on commit ff1634c

Please sign in to comment.