require Exporter; #*import = \&Exporter::import; @EXPORT_OK = qw(isa can); my( $overused, $unimportant ); sub import { my( $pack )= @_; if( $pack =~ /^UNIVERSAL$/i ) { @_= grep { not /^overused?$/i ? ( $overused= 1 ) : /^unimport(ant)?$/i ? ( $unimportant= 1 ) : 0 } @_; goto &Exporter::import; } elsif( keys %{$pack."::"} <= 1 ) { my @matches= ( "::" ); foreach my $file ( split /::/, $pack ) { @matches= map { my $match= $_; my @files= grep /^\Q$file\E::$/i, keys %{$match}; map { $match.$_ } @files; } @matches; } @matches= grep { s/^:://; s/::$//; $_ ne $pack } @matches; die "$pack->import() called for empty package!\nPerhaps you need to use ", 1 == @matches ? "C instead.\n" : @matches ? "one of these (@matches).\n" : "different upper/lower case in C.\n"; } else { warn "C but no $pack\::import().\n" if $overused; goto &Exporter::import unless $unimportant; } }