--- nfo/perl/libs/mixin.pm 2002/12/12 02:47:51 1.1 +++ nfo/perl/libs/mixin.pm 2002/12/12 02:48:30 1.2 @@ -88,6 +88,7 @@ # mixin::with" typically runs *before* the rest of the mixin's # subroutines are declared. _thieve_public_methods( $mixin, $pkg ); + _thieve_private_methods( $mixin, $pkg ); _thieve_isa( $mixin, $pkg, $with ); unshift @{$caller.'::ISA'}, $pkg; @@ -98,7 +99,7 @@ sub _thieve_public_methods { my($mixin, $pkg) = @_; - return if $Thieved{$mixin}++; + return if $Thieved{$mixin . '_public'}++; local *glob; while( my($sym, $glob) = each %{$mixin.'::'}) { @@ -106,6 +107,21 @@ next unless defined $glob; *glob = *$glob; *{$pkg.'::'.$sym} = *glob{CODE} if *glob{CODE}; + } + + return 1; +} +sub _thieve_private_methods { + my($mixin, $pkg) = @_; + + return if $Thieved{$mixin . '_private'}++; + + local *glob; + while( my($sym, $glob) = each %{$mixin.'::'}) { + next if $sym !~ /^_/; + next unless defined $glob; + *glob = *$glob; + *{$pkg.'::'.$sym} = *glob{CODE} if *glob{CODE}; } return 1;