use strict; use warnings; use Data::Dump qw/pp dd/; sub create_class { my ($class) = @_; my $source = <<"__CODE__"; package $class; sub import { warn "$class imported"; } __CODE__ eval $source; my $name = $class =~ s(::)(\/)gr; $INC{"$name.pm"} = 'imported via eval'; } BEGIN { create_class('Jabba::Dabba'); } pp \%INC; use Jabba::Dabba; #### -*- mode: compilation; default-directory: "d:/tmp/pm/" -*- Compilation started at Mon Dec 28 17:34:59 C:/Perl_524/bin\perl.exe -w d:/tmp/pm/create_class.pl Jabba::Dabba imported at (eval 1) line 5. { "C:/Perl_524/site/lib/sitecustomize.pl" => "C:/Perl_524/site/lib/sitecustomize.pl", "Data/Dump.pm" => "C:/Perl_524/lib/Data/Dump.pm", "Exporter.pm" => "C:/Perl_524/lib/Exporter.pm", "Jabba/Dabba.pm" => "imported via eval", "overload.pm" => "C:/Perl_524/lib/overload.pm", "overloading.pm" => "C:/Perl_524/lib/overloading.pm", "strict.pm" => "C:/Perl_524/lib/strict.pm", "subs.pm" => "C:/Perl_524/lib/subs.pm", "vars.pm" => "C:/Perl_524/lib/vars.pm", "warnings.pm" => "C:/Perl_524/lib/warnings.pm", "warnings/register.pm" => "C:/Perl_524/lib/warnings/register.pm", } Compilation finished at Mon Dec 28 17:34:59