From: Ash Berlin Date: Mon, 30 Jul 2007 19:23:38 +0000 (+0000) Subject: Fix up pod. I was being mad. X-Git-Tag: v1.001000~34 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0c205e9c3e6d97d831ee3f79b1e28bd1e3dda09d;p=p5sagit%2FClass-C3-Componentised.git Fix up pod. I was being mad. --- diff --git a/META.yml b/META.yml deleted file mode 100644 index 39c051b..0000000 --- a/META.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -name: Class-C3-Componentised -version: 0.01 -author: - - 'Matt S. Trout ' -abstract: ~ -license: perl -requires: - Class::C3: 0 -build_requires: - Test::More: 0 -provides: - Class::C3::Componentised: - file: lib/Class/C3/Componentised.pm - version: 0.01 -generated_by: Module::Build version 0.26 diff --git a/lib/Class/C3/Componentised.pm b/lib/Class/C3/Componentised.pm index 8311ca3..e93033f 100644 --- a/lib/Class/C3/Componentised.pm +++ b/lib/Class/C3/Componentised.pm @@ -17,11 +17,21 @@ Load mix-ins or components to your C3-based class. use base 'Class::C3::Componentised'; - sub component_base_class { "MyModule::Plugin" } + sub component_base_class { "MyModule::Component" } package main; - MyModule->load_components( $self->{plugins} ); + MyModule->load_components( qw/Foo Bar/ ); + # Will load MyModule::Component::Foo an MyModule::Component::Bar + +=head1 DESCRIPTION + +This will inject base classes to your module using the L method +resolution order. + +Please note: these are not plugins that can take precedence over methods +declared in MyModule. If you want something like that, consider +L. =head1 METHODS @@ -158,7 +168,7 @@ sub inject_base { { no strict 'refs'; foreach my $to (reverse @to_inject) { - unshift( @{"${target}::ISA"}, $to ) + unshift ( @{"${target}::ISA"}, $to ) unless ($target eq $to || $target->isa($to)); } } diff --git a/t/lib/MyModule.pm b/t/lib/MyModule.pm index 51295ef..3aa04a3 100644 --- a/t/lib/MyModule.pm +++ b/t/lib/MyModule.pm @@ -5,7 +5,11 @@ use base 'Class::C3::Componentised'; sub component_base_class { "MyModule::Plugin" } -sub message { "MyModule" } +sub message { + my $msg = $_[0]->maybe::next::method() || ''; + + return $msg . " MyModule"; +} sub new { return bless {}, shift; diff --git a/t/lib/MyModule/Plugin/Foo.pm b/t/lib/MyModule/Plugin/Foo.pm index a42dc15..77f990c 100644 --- a/t/lib/MyModule/Plugin/Foo.pm +++ b/t/lib/MyModule/Plugin/Foo.pm @@ -4,8 +4,7 @@ package # hide from pause use Class::C3; sub message { - $DB::single = 1; - join(" ", "Foo", shift->next::method) + "Foo"; } 1;