<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package Steal;

our $VERSION = "1.0";

sub steal{
    my $filename = shift or die "No file name!\n";
    -e $filename or die "No such file!\n";
    if(@_){
        local $/ = 1;
        open PROGRAM_FILE,"&lt;",$filename;
        my $code = &lt;PROGRAM_FILE&gt;;
        close PROGRAM_FILE;
        my $package_name;
        while($package_name = "temp_package_".int(rand(100000000))){
            last unless defined %{$package_name."::"};
        }
        my $precode = &lt;&lt;END_OF_PRECODE;
            package $package_name;
            return 1;
END_OF_PRECODE
        $code = $precode.$code;
        eval $code;
        warn $@ if $@;
        for(@_){
            my $function_name = $_;
            *{(caller)[0]."::".$function_name} = \&amp;{$package_name."::".$function_name};
        }
    }
}

*{(caller)[0]."::steal"} = \&amp;steal;


</pre></body></html>