#!/usr/bin/perl
package Muse;

require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(muse);

sub muse {
	$!='';
	 my ($Module,@LIST) = @_;
	 my $code;
	 $code="require $Module; import $Module qw(".join(' ',@LIST).");";
	 eval $code;
	 if ($!) {
 	        $Module = reverse $Module;
		my (undef,$parent) = split /::/,$Module,2;
		$Module = reverse $Module;
		$parent = reverse $parent;
		$code  = '';
		$code .="package $Module;\n";
		$code .="use Muse qw(muse);\n";
		$code .="muse('$parent');\n";
		$code .="\@ISA=qw($parent);\n";
		$code .="1;\n";
		eval "$code\n";
	};
}	


1;
