App-VirtualBoxUtils
view release on metacpan or search on metacpan
lib/App/VirtualBoxUtils.pm view on Meta::CPAN
# }
# }
# my $num_started = keys %started;
# if ($num_started == 0) {
# return [304,
# $num_start_requests ? "All browsers already have processes" :
# "Not ${which_action}ing any browsers"];
# }
# my (%alive, %not_alive);
# if ($args{-dry_run}) {
# %alive = %started;
# } else {
# for my $wait_time (2, 5, 10) {
# %alive = ();
# %not_alive = ();
# log_trace "Checking if the started browsers are alive ...";
# for my $browser (keys %pbs) {
# if ($pbs{$browser}->alive) {
# $alive{$browser}++;
# } else {
# $not_alive{$browser}++;
# }
# }
# last if scalar(keys %alive) == $num_started;
# }
# }
# my $num_alive = keys %alive;
# my $num_not_alive = keys %not_alive;
# my $status;
# my $reason;
# my $msg;
# my $verb_started = $which_action eq 'restart' ? 'Started/restarted' : 'Started';
# if ($num_alive == $num_started) {
# $status = 200;
# $reason = "OK";
# $msg = "$verb_started ".join(", ", sort keys %alive);
# } elsif ($num_alive == 0) {
# $status = 500;
# $reason = $msg = "Can't start any browser (".join(", ", %not_alive).")";
# } else {
# $status = 200;
# $reason = "OK";
# $msg = "$verb_started ".join(", ", sort keys %alive)."; but failed to start ".
# join(", ", sort keys %not_alive);
# }
# $fail{$_} //= "Can't start" for keys %not_alive;
# [$status, $msg, undef, {
# 'func.outputs' => \%outputs,
# ($which_action eq 'start' ? ('func.has_processes' => [sort keys %has_processes]) : ()),
# 'func.started' => [sort grep {!$terminated{$_}} keys %alive],
# ($which_action eq 'restart' ? ('func.restarted' => [sort grep {$terminated{$_}} keys %alive]) : ()),
# 'func.fail' => [sort keys %fail],
# }];
# }
( run in 0.502 second using v1.01-cache-2.11-cpan-4d4bc49f3ae )