Acme-Fork-Lazy
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
$self->provides( %{ $build->find_dist_packages || {} } );
}
sub feature {
my $self = shift;
my $name = shift;
my $features = ( $self->{values}{features} ||= [] );
my $mods;
if ( @_ == 1 and ref( $_[0] ) ) {
# The user used ->feature like ->features by passing in the second
# argument as a reference. Accomodate for that.
$mods = $_[0];
} else {
$mods = \@_;
}
my $count = 0;
push @$features, (
$name => [
map {
t/01_basic.t view on Meta::CPAN
my $foo = forked { 2+3 };
is ($foo, 5, 'Simple deferred calculation');
PARALLEL: {
my @list = map forked { sleep $_; $_*3 }, 1..4;
sleep 2; # gives time for half of list to be processed
my $t = time;
is_deeply( \@list, [3,6,9,12], 'List was correct' );
my $delta = time-$t;
# we'd expect to have been at least another 2 seconds
ok( ($delta >= 2) && ($delta <= 3), 'Waited ca another 2 seconds to process rest of list');
}
# COMPLEX CALC
my $complex = forked { [1,2] };
TODO: {
local $TODO = 1;
is_deeply( $complex, [1,2], "Complex value is forced correctly" );
}
is_deeply( [@$complex], [1,2], "Complex value is correct, if manually forced" );
( run in 2.028 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )