1#!/usr/bin/perl -w 2BEGIN { 3 if( $ENV{PERL_CORE} ) { 4 chdir 't' if -d 't'; 5 chdir '../lib/parent'; 6 @INC = '..'; 7 } 8} 9 10use strict; 11use Test::More tests => 9; 12use lib 't/lib'; 13 14{ 15 package Child; 16 use parent 'Dummy'; 17} 18 19{ 20 package Child2; 21 require Dummy; 22 use parent -norequire, 'Dummy::InlineChild'; 23} 24 25{ 26 package Child3; 27 use parent "Dummy'Outside"; 28} 29 30my $obj = {}; 31bless $obj, 'Child'; 32isa_ok $obj, 'Dummy'; 33can_ok $obj, 'exclaim'; 34is $obj->exclaim, "I CAN FROM Dummy", 'Inheritance is set up correctly'; 35 36$obj = {}; 37bless $obj, 'Child2'; 38isa_ok $obj, 'Dummy::InlineChild'; 39can_ok $obj, 'exclaim'; 40is $obj->exclaim, "I CAN FROM Dummy::InlineChild", 'Inheritance is set up correctly for inlined classes'; 41 42$obj = {}; 43bless $obj, 'Child3'; 44isa_ok $obj, 'Dummy::Outside'; 45can_ok $obj, 'exclaim'; 46is $obj->exclaim, "I CAN FROM Dummy::Outside", "Inheritance is set up correctly for classes inherited from via '"; 47 48