use strict 'vars';
use vars qw($VERSION);
-$VERSION = '2.07';
+$VERSION = '2.08';
# constant.pm is slow
sub SUCCESS () { 1 }
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)) {
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
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 10;
+use Test::More tests => 11;
use_ok('base');
eval q{use base 'reallyReAlLyNotexists'};
like( $@, qr/^Base class package "reallyReAlLyNotexists" is empty./,
' still empty on 2nd load');
+{
+ my $warning;
+ local $SIG{__WARN__} = sub { $warning = shift };
+ eval q{package HomoGenous; use base 'HomoGenous';};
+ like($warning, qr/^Class 'HomoGenous' tried to inherit from itself/,
+ ' self-inheriting');
+}
BEGIN { $Has::Version_0::VERSION = 0 }