X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fbase.pm;h=d8baa95d0a1063f4ca5ea69d44da78030ce1c5fe;hb=99ffb1cb9ad68572b442d79446caa8bcbb2964fc;hp=9c2135bfb6b4e6bbf8fbfa3bc59b1bc5c50ab266;hpb=3c4b39bee8832007b7e91bfce8701d34cacab411;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/base.pm b/lib/base.pm index 9c2135b..d8baa95 100644 --- a/lib/base.pm +++ b/lib/base.pm @@ -2,7 +2,7 @@ package base; use strict 'vars'; use vars qw($VERSION); -$VERSION = '2.07'; +$VERSION = '2.08'; # constant.pm is slow sub SUCCESS () { 1 } @@ -71,6 +71,10 @@ sub import { my $inheritor = caller(0); foreach my $base (@_) { + if ( $inheritor eq $base ) { + warn "Class '$inheritor' tried to inherit from itself\n"; + } + next if $inheritor->isa($base); if (has_version($base)) { @@ -212,6 +216,12 @@ found in your path. This module was introduced with Perl 5.004_04. +Attempting to inherit from yourself generates a warning: + + use Foo; + use base 'Foo'; + + # Class 'Foo' tried to inherit from itself =head1 CAVEATS