sub import { my ( $self, $flag ) = @_; if ( defined $flag and $flag eq ':modern' ) { if ( defined $MODE ) { if ( $MODE == 0 ) { warn "Note: Foo is in classic mode\n" } } else { $MODE = 1; Foo-> export_to_level( 1, 'Foo', keys %const ); no warnings 'redefine'; *Foo::m2 = \&Foo::Modern::m2; # etc. # longer list } } else { if ( defined $MODE ) { if ( $MODE == 1 ) { warn "Note: Foo is in modern mode\n" } } else { $MODE = 0 } } }