use 5.008; use File::Slurp qw/ read_file /; unshift @INC => sub { return undef unless $_[1] eq 'Win32/API/Type.pm'; my $f = your_favourite_module_locate_routine(...); my $src = read_file($f); $src =~ s/INIT (?={)//; open my $fh, '<', \$src or die "I have no idea if or why this would ever die, but anyway: $!"; return $fh; };