Acme-Fork-Lazy
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
}
# Cloned from Params::Util::_CLASS
sub _CLASS ($) {
(
defined $_[0]
and
! ref $_[0]
and
$_[0] =~ m/^[^\W\d]\w*(?:::\w+)*$/s
) ? $_[0] : undef;
}
1;
# Copyright 2008 Adam Kennedy.
lib/Acme/Fork/Lazy.pm view on Meta::CPAN
Exporter::export_ok_tags('all');
sub forked (&) {
my $sub = shift;
my $p = IO::Pipe->new();
if (my $child = fork) {
$p->reader;
return lazy {
waitpid $child, 0;
local $/ = undef;
my $result = <$p>;
Load($result);
};
} else {
$p->writer;
my @result = $sub->();
print $p Dump(@result);
exit;
}
}
( run in 3.747 seconds using v1.01-cache-2.11-cpan-d80b1682f3f )