From: Graham Knop Date: Thu, 15 Feb 2018 09:31:06 +0000 (+0100) Subject: whitespace cleanup X-Git-Tag: v1.001_001~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3a23b721f6d10d2d3369e2aa1f3b3bfeb46def0a;p=p5sagit%2FClass-C3-Componentised.git whitespace cleanup --- diff --git a/Changes b/Changes index 8538ecc..dbcdb17 100644 --- a/Changes +++ b/Changes @@ -31,7 +31,7 @@ Revision history for Class-C3-Componentised 1.0003 5 Mar 2008 Fix tests on perl 5.10.0 -1.0002 4 Mar 2008 +1.0002 4 Mar 2008 Make tests more resilient 1.0001 11 Aug 2007 diff --git a/lib/Class/C3/Componentised.pm b/lib/Class/C3/Componentised.pm index d7b436e..a615ec1 100644 --- a/lib/Class/C3/Componentised.pm +++ b/lib/Class/C3/Componentised.pm @@ -17,7 +17,7 @@ Class::C3::Componentised - Load mix-ins or components to your C3-based class package main; - MyModule->load_components( qw/Foo Bar/ ); + MyModule->load_components( qw/Foo Bar/ ); # Will load MyModule::Component::Foo and MyModule::Component::Bar =head1 DESCRIPTION @@ -25,7 +25,7 @@ Class::C3::Componentised - Load mix-ins or components to your C3-based class 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 +Please note: these are not plugins that can take precedence over methods declared in MyModule. If you want something like that, consider L. @@ -53,7 +53,7 @@ my $invalid_class = qr/(?: \b:\b | \:{3,} | \:\:$ )/x; =head2 load_components( @comps ) -Loads the given components into the current module. If a module begins with a +Loads the given components into the current module. If a module begins with a C<+> character, it is taken to be a fully qualified class name, otherwise C<< $class->component_base_class >> is prepended to it. @@ -93,7 +93,7 @@ sub _load_components { =head2 load_optional_components -As L, but will silently ignore any components that cannot be +As L, but will silently ignore any components that cannot be found. =cut diff --git a/lib/Class/C3/Componentised/ApplyHooks.pm b/lib/Class/C3/Componentised/ApplyHooks.pm index 49d9948..8cc49fb 100644 --- a/lib/Class/C3/Componentised/ApplyHooks.pm +++ b/lib/Class/C3/Componentised/ApplyHooks.pm @@ -44,7 +44,7 @@ sub _apply_component_to_class { $target->$f($parent) } } -} +} { no strict 'refs'; @@ -119,7 +119,7 @@ Class::C3::Componentised::ApplyHooks =head1 DESCRIPTION This package allows a given component to run methods on the class that is being -injected into before or after the component is injected. Note from the +injected into before or after the component is injected. Note from the L that all C may be run more than once. =head1 IMPORT ACTION diff --git a/t/00-load.t b/t/00-load.t index 505112a..d593da8 100644 --- a/t/00-load.t +++ b/t/00-load.t @@ -1,7 +1,7 @@ use Test::More tests => 1; BEGIN { - use_ok( 'Class::C3::Componentised' ); + use_ok( 'Class::C3::Componentised' ); } diag( "Testing Class::C3::Componentised $Class::C3::Componentised::VERSION, Perl $], $^X" ); diff --git a/t/01-basic.t b/t/01-basic.t index 8bc81fd..f0a35b4 100644 --- a/t/01-basic.t +++ b/t/01-basic.t @@ -58,7 +58,7 @@ eval { MyModule->load_optional_class('ENDS::WITH::COLONS::') }; like( $@, qr/Invalid class name 'ENDS::WITH::COLONS::'/, 'Throw on Class::' ); # Simulate a PAR environment -{ +{ my @code; local @INC = @INC; unshift @INC, sub { @@ -73,7 +73,7 @@ like( $@, qr/Invalid class name 'ENDS::WITH::COLONS::'/, 'Throw on Class::' ); $retval = eval { MyModule->load_optional_class('FAKE::PAR::PACKAGE') }; ok( !$@, 'load_optional_class on a nonexistent PAR class did not throw' ); ok( !$retval, 'nonexistent PAR package not loaded' ); - + # simulate a class which does load but does not return true @code = ( @@ -84,7 +84,7 @@ like( $@, qr/Invalid class name 'ENDS::WITH::COLONS::'/, 'Throw on Class::' ); $retval = eval { MyModule->load_optional_class('VIRTUAL::PAR::PACKAGE') }; ok( $@, 'load_optional_class of a no-true-returning PAR module did throw' ); ok( !$retval, 'no-true-returning PAR package not loaded' ); - + # simulate a normal class (no one adjusted %INC so it will be tried again @code = ( q/package VIRTUAL::PAR::PACKAGE;/, @@ -94,7 +94,7 @@ like( $@, qr/Invalid class name 'ENDS::WITH::COLONS::'/, 'Throw on Class::' ); $retval = eval { MyModule->load_optional_class('VIRTUAL::PAR::PACKAGE') }; ok( !$@, 'load_optional_class of a PAR module did not throw' ); ok( $retval, 'PAR package "loaded"' ); - + # see if we can still load stuff with the coderef present $retval = eval { MyModule->load_optional_class('AnotherModule') }; ok( !$@, 'load_optional_class did not throw' ) || diag $@; diff --git a/t/lib/MyModule.pm b/t/lib/MyModule.pm index f7dae37..0efcb0f 100644 --- a/t/lib/MyModule.pm +++ b/t/lib/MyModule.pm @@ -5,13 +5,13 @@ use base 'Class::C3::Componentised'; sub component_base_class { "MyModule::Plugin" } -sub message { +sub message { my $msg = $_[0]->maybe::next::method() || ''; - + return $msg . ' ' . __PACKAGE__; } -sub new { +sub new { return bless {}, shift; } diff --git a/t/lib/MyModule/Plugin/Foo.pm b/t/lib/MyModule/Plugin/Foo.pm index 0f12956..90f3745 100644 --- a/t/lib/MyModule/Plugin/Foo.pm +++ b/t/lib/MyModule/Plugin/Foo.pm @@ -4,7 +4,7 @@ package # hide from pause use MRO::Compat; use mro 'c3'; -sub message { +sub message { "Foo"; } diff --git a/t/lib/MyModuleNoBase.pm b/t/lib/MyModuleNoBase.pm index 969f5bc..5c997eb 100644 --- a/t/lib/MyModuleNoBase.pm +++ b/t/lib/MyModuleNoBase.pm @@ -3,13 +3,13 @@ package # hide from pause use base 'Class::C3::Componentised'; -sub message { +sub message { my $msg = $_[0]->maybe::next::method() || ''; - + return $msg . ' ' . __PACKAGE__; } -sub new { +sub new { return bless {}, shift; }