The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

use strict; use warnings;
our $DIAG = eval {
require diagnostics;
diagnostics->import();
1;
};
sub import {
my ($package, $option) = @_;
$option ||= '';
}
our $DIR;
BEGIN {
($_, $DIR) = caller(2);
$DIR =~ s/.*?(\w+)\.t$/$1/ or die;
$DIR = "_Inline_$DIR.$$";
rmtree($DIR) if -d $DIR;
mkdir($DIR) or die "$DIR: $!\n";
}
my $absdir = File::Spec->rel2abs($DIR);
($absdir) = $absdir =~ /(.*)/; # untaint
my $startpid = $$;
END {
if($$ == $startpid) { # only when original process exits
rmtree($absdir);
}
}
1;