From: Peter Rabbitson Date: Fri, 7 Dec 2012 07:06:24 +0000 (+0100) Subject: Fix SYNOPSIS to actually be executable (RT#78327) X-Git-Tag: 0.25~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cf11b23515e4016ed2f573447b11916b3f71b68c;p=gitmo%2FClass-C3.git Fix SYNOPSIS to actually be executable (RT#78327) Also stop using 'B' as it brings a spurious Exporter inheritance into the mix --- diff --git a/ChangeLog b/ChangeLog index 954cd19..9d89e70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ Revision history for Perl extension Class::C3. - Pod typo fixes (RT#77453) - Only ask for Devel::Hide on perls where it will be actually used (RT#81106) + - Fix SYNOPSIS to actually be executable (RT#78327) 0.24 Sat, May 12, 2012 - Require Class::C3::XS on 5.8 perls if a working compiler is found diff --git a/lib/Class/C3.pm b/lib/Class/C3.pm index 3551a1e..e9bf3c1 100644 --- a/lib/Class/C3.pm +++ b/lib/Class/C3.pm @@ -238,22 +238,22 @@ Class::C3 - A pragma to use the C3 method resolution order algorithm =head1 SYNOPSIS # NOTE - DO NOT USE Class::C3 directly as a user, use MRO::Compat instead! - package A; + package ClassA; use Class::C3; sub hello { 'A::hello' } - package B; - use base 'A'; + package ClassB; + use base 'ClassA'; use Class::C3; - package C; - use base 'A'; + package ClassC; + use base 'ClassA'; use Class::C3; sub hello { 'C::hello' } - package D; - use base ('B', 'C'); + package ClassD; + use base ('ClassB', 'ClassC'); use Class::C3; # Classic Diamond MI pattern @@ -269,12 +269,12 @@ Class::C3 - A pragma to use the C3 method resolution order algorithm # (formerly called in INIT) Class::C3::initialize(); - print join ', ' => Class::C3::calculateMRO('Diamond_D') # prints D, B, C, A + print join ', ' => Class::C3::calculateMRO('ClassD'); # prints ClassD, ClassB, ClassC, ClassA - print D->hello() # prints 'C::hello' instead of the standard p5 'A::hello' + print ClassD->hello(); # prints 'C::hello' instead of the standard p5 'A::hello' - D->can('hello')->(); # can() also works correctly - UNIVERSAL::can('D', 'hello'); # as does UNIVERSAL::can() + ClassD->can('hello')->(); # can() also works correctly + UNIVERSAL::can('ClassD', 'hello'); # as does UNIVERSAL::can() =head1 DESCRIPTION