view release on metacpan or search on metacpan
$g = Games::GuessWord->new(file => "t/words");
ok($g, "should create object ok");
foreach (1..21) {
# print $g->secret . "\n";
$g->new_word;
ok($g->secret =~ /^(awake|asleep|alive)$/, "should read word in ok");
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Games/Lacuna/Client/Governor.pm view on Meta::CPAN
$self->{status} = $data->{status};
my $planets = $self->{status}->{empire}->{planets};
my $home_planet_id = $self->{status}->{empire}->{home_planet_id};
$self->{planet_names} = { map { $_ => $planets->{$_} } keys %$planets };
my $do_keepalive = 1;
my $start_time = time();
$self->load_cache();
do {
my @priorities;
if ( $self->{config}->{dry_run} ) {
message("Starting dry run, actions are not actually taking place...");
}
$do_keepalive = 0;
for my $pid ( keys %$planets ) {
next if ( time() < $self->{next_action}->{$pid} );
trace( "Examining " . $planets->{$pid} ) if ( $self->{config}->{verbosity}->{trace} );
my $colony_config = merge( $config->{colony}->{ $planets->{$pid} } || {}, $config->{colony}->{_default_} );
lib/Games/Lacuna/Client/Governor.pm view on Meta::CPAN
if ( $self->{config}->{dry_run} ) {
message("Dry run complete.");
return;
}
my $next_action_in = min( grep { $_ > time } values %{ $self->{next_action} } ) - time;
if ( defined $next_action_in && ( $next_action_in + time ) < ( $config->{keepalive} + $start_time ) ) {
if ( $next_action_in <= 0 ) {
$do_keepalive = 0;
}
else {
my $nat_time = ptime($next_action_in);
trace("Expecting to govern again in $nat_time or so, sleeping...") if ($self->{config}->{verbosity}->{trace});
sleep( $next_action_in + 5 );
$do_keepalive = 1;
}
}
} while ($do_keepalive);
$self->write_cache();
}
sub govern {
lib/Games/Lacuna/Client/Governor.pm view on Meta::CPAN
=head2 dry_run
If this is true, Governor goes through the motions but does not actually
trigger any actions (such as upgrades, recycling jobs, or pushes). The
output shows the actions as they would have taken place. Enabling dry_run
disables keepalive behavior.
=head2 keepalive
This is the window of time, in seconds, to try to keep the governor alive
if more actions are possible. Basically, if any governed colony's build
queue will be empty before the keepalive window expires, the script will
not terminate, but will instead sleep and wait for that build queue to empty
before once again governing that colony. Setting this to 0 will
effectively disable this behavior.
=head2 push_max_travel_time
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Games/PangZero/PlayableGameBase.pm view on Meta::CPAN
sub new {
my ($class) = @_;
my $self = Games::PangZero::GameBase->new();
%{$self} = (%{$self},
'playersalive' => 0,
'level' => 0,
'backgrounds' => [ qw( desert2.png l1.jpg l2.jpg l3.jpg l4.jpg l5.jpg l6.jpg l7.jpg l8.jpg l9.jpg )],
);
bless $self, $class;
}
sub ResetGame {
my $self = shift;
$self->SUPER::ResetGame();
$self->{playersalive} = 0;
$Games::PangZero::GamePause = 0;
foreach my $player (@Games::PangZero::Players) {
last if $player->{number} >= $Games::PangZero::NumGuys;
$self->SpawnPlayer($player);
lib/Games/PangZero/PlayableGameBase.pm view on Meta::CPAN
$player->{lives} = 2;
$player->{startX} = ($Games::PangZero::ScreenWidth - $Games::PangZero::NumGuys * 60) / 2 + 60 * ($player->{number}+0.5) - 32;
$player->{respawn} = -1;
my $guy = Games::PangZero::Guy->new($player);
push @Games::PangZero::GameObjects, ($guy);
++$self->{playersalive};
return $guy;
}
sub AdvanceGameObjects {
my ($self) = @_;
lib/Games/PangZero/PlayableGameBase.pm view on Meta::CPAN
foreach my $player (@Games::PangZero::Players) {
last if $player->{number} >= $Games::PangZero::NumGuys;
if ($player->{respawn} > 0) {
--$player->{respawn};
$player->{score} = int($player->{respawn} / 100) if $self->{playersalive};
if ($player->{respawn} <= 0) {
my $guy = $self->SpawnPlayer($player);
$guy->{invincible} = 500;
}
}
lib/Games/PangZero/PlayableGameBase.pm view on Meta::CPAN
$self->{playerspawned} = 1;
} else {
# One player less
Games::PangZero::Highscore::AddHighScore($guy->{player}, $guy->{player}->{score}, $self->{level} + 1);
$guy->Delete();
--$self->{playersalive};
$guy->{player}->{respawn} = 6000; # 60s
}
}
sub PlayerDeathSequence {
lib/Games/PangZero/PlayableGameBase.pm view on Meta::CPAN
if ($Games::PangZero::GameEvents{meltdown} and $Games::PangZero::DifficultyLevel->{name} ne 'Miki') {
$self->DeathballMeltdown();
} elsif ($Games::PangZero::GameEvents{kill} ) {
$self->PlayerDeathSequence();
return if $self->{playersalive} <= 0;
$Games::PangZero::GamePause = 200 if $Games::PangZero::GamePause < 200;
Games::PangZero::GamePause::Show();
} elsif ($Games::PangZero::GameEvents{magic}) {
if ($Games::PangZero::GamePause < 200) {
$Games::PangZero::GamePause = 200;
lib/Games/PangZero/PlayableGameBase.pm view on Meta::CPAN
while ($advance--) {
return if $self->{abortgame};
$self->AdvanceGame();
}
if ($self->{playersalive} <= 0) {
my $gameoverSurface = SDL::Image::load("$Games::PangZero::DataDir/gameover.png");
my @gameObjects = @Games::PangZero::GameObjects;
foreach (@gameObjects) { $_->Delete() if ('Games::PangZero::DeadGuy' eq ref $_); }
$self->DrawGame();
SDL::Video::blit_surface($gameoverSurface, SDL::Rect->new(0, 0, $gameoverSurface->w, $gameoverSurface->h),
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Games/Perlwar.pm view on Meta::CPAN
{ owner => '1337 h4ck3r', name => 'crash me', code => 'exit' },
{ owner => '1337 h4ck3r', name => 'readdir me', code => 'opendir DIR, "."; return readdir DIR;' },
{ owner => '1337 h4ck3r', name => 'infinite loop', code => '1 while 1' },
{ owner => '1337 h4ck3r', name => 'backticks', code => '`ls`' },
{ owner => '1337 h4ck3r', name => 'kill next', code => '"!1"' },
{ owner => '1337 h4ck3r', name => 'must die', code => '"I am still alive?"' },
{ owner => 'Yanick', name => 'good boy', code => '1' },
{ owner => 'Yanick', name => 'owner', code => '"~-1"' },
{ owner => 'Yanick', name => 'too big', code => 'a' x 200 },
];
$pw->{config}{arraySize} = @{ $pw->{theArray} };
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Games/Snake.pm view on Meta::CPAN
$player->direction( [ 1, 0 ] ) if $event->key_sym == SDLK_RIGHT;
$player->direction( [ 0, -1 ] ) if $event->key_sym == SDLK_UP;
$player->direction( [ 0, 1 ] ) if $event->key_sym == SDLK_DOWN;
my $key = SDL::Events::get_key_name( $event->key_sym );
if ( !$player->alive && $key eq 'r' ) {
$self->player( $self->_build_player );
}
}
}
lib/Games/Snake.pm view on Meta::CPAN
my $player = $self->player;
$player->move($t);
if ( $player->hit_self() || $level->is_wall( $player->head ) ) {
$player->alive(0);
}
elsif ($player->head->[0] == $self->apple->[0]
&& $player->head->[1] == $self->apple->[1] )
{
$player->speed( $player->speed * 0.9 );
lib/Games/Snake.pm view on Meta::CPAN
0xC20006FF );
$self->player->draw($app);
$self->level->draw($app);
if ( !$self->player->alive ) {
$app->draw_gfx_text( [ 12, 12 ],
0xFFFFFFFF,
'Snake length: ' . scalar @{ $self->player->segments } );
$app->draw_gfx_text( [ 12, 22 ], 0xFFFFFFFF, 'Press R to restart' );
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Games/Word/Wordlist/Enable.pm view on Meta::CPAN
alighting alightment alightments alights align aligned aligner aligners
aligning alignment alignments aligns alike alikeness alikenesses aliment
alimentary alimentation alimentations alimented alimenting aliments alimonies
alimony aline alined alinement alinements aliner aliners alines alining aliped
alipeds aliphatic aliquant aliquot aliquots alist alit aliteracies aliteracy
aliterate aliterates aliunde alive aliveness alivenesses aliya aliyah aliyahs
aliyas aliyos aliyot aliyoth alizarin alizarins alkahest alkahestic alkahests
alkali alkalic alkalies alkalified alkalifies alkalify alkalifying alkalimeter
alkalimeters alkalimetries alkalimetry alkalin alkaline alkalinities
alkalinity alkalinization alkalinizations alkalinize alkalinized alkalinizes
alkalinizing alkalis alkalise alkalised alkalises alkalising alkalize
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Games/Word/Wordlist/SGB.pm view on Meta::CPAN
adieu adios adlib adman admen admit admix adobe adopt adore adorn adult
adzes aegis aerie affix afire afoot afore afoul after again agape agars
agate agave agent agile aging agley aglow agone agony agora agree agues
ahead ahhhh ahold ahoys aided aider aides ailed aimed aimer aioli aired
airer aisle aitch ajuga alack alarm album alder aleck aleph alert algae
algal algin alias alibi alien align alike alive alkyd alkyl allay alley
allot allow alloy aloes aloft aloha alone along aloof aloud alpha altar
alter altho altos alums alway amahs amass amaze amber ambit amble ameba
amend amens amide amigo amine amino amiss amity ammos among amour amped
ample amply amuck amuse amyls anded anent angel anger angle angry angst
anile anima anion anise ankhs ankle annas annex annoy annul annum anode
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Games/Worms/Base.pm view on Meta::CPAN
#--------------------------------------------------------------------------
sub try_move {
my $worm = $_[0];
return unless $worm->is_alive;
if($Debug > 2) {
sleep 1;
}
my $current_node = $worm->{'current_node'};
lib/Games/Worms/Base.pm view on Meta::CPAN
my $c = shift;
$c = ref($c) || $c;
my $it = bless { @_ }, $c;
$it->{'uid'} = $uid++; # per-session unique, if we need it
$it->{'is_alive'} = 1 unless defined $it->{'is_alive'};
$it->{'color'} ||= $it->default_color;
$it->{'segments_eaten'} = 0;
$it->{'last_segment_eaten'} = 0;
$it->{'memoize'} = $it->am_memoized;
$it->{'can_zombie'} = $it->can_zombie;
lib/Games/Worms/Base.pm view on Meta::CPAN
sub segments_eaten {
my $it = $_[0];
return $it->{'segments_eaten'};
}
sub is_alive { # regardless of whether undead or not
my $it = $_[0];
return $it->{'is_alive'};
}
#sub current_node {
# my $it = $_[0];
# return $it->{'current_node'};
#}
sub die { # kill this worm.
my $worm = $_[0];
print " worm $worm dies\n" if $Debug;
$worm->{'is_alive'} = 0;
$worm->{'is_undead'} = 0;
}
sub really_die { # kill this worm DEAD.
my $worm = $_[0];
print " worm $worm really dies\n" if $Debug;
$worm->{'is_alive'} = 0;
$worm->{'is_undead'} = 0;
}
sub eat_segment {
view all matches for this distribution
view release on metacpan or search on metacpan
example/apache-status view on Meta::CPAN
my @sc_order = (
'waiting',
'starting',
'reading_request',
'sending_reply',
'keepalive',
'dns_lookup',
'closing',
'logging',
'gracefully_finishing',
'idle',
example/apache-status view on Meta::CPAN
my %sc_byname = (
'waiting' => '_',
'starting' => 'S',
'reading_request' => 'R',
'sending_reply' => 'W',
'keepalive' => 'K',
'dns_lookup' => 'D',
'closing' => 'C',
'logging' => 'L',
'gracefully_finishing' => 'G',
'idle' => 'I',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Gazelle.pm view on Meta::CPAN
Gazelle supports following features:
=over
=item * Supports HTTP/1.1. (Without Keepalive support.)
=item * Ultra fast HTTP processing using picohttpparser.
=item * Uses accept4(2) if the operating system supports it.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Gearman/Client/Async.pm view on Meta::CPAN
use warnings;
use Carp qw(croak);
use fields (
'job_servers', # arrayref of Gearman::Client::Async::Connection objects
't_no_random', # don't randomize job server to use: use first alive one.
't_offline_host', # hashref: hostname -> $bool, if host should act as offline, for testing
);
use Danga::Socket 1.52;
use Gearman::Objects;
lib/Gearman/Client/Async.pm view on Meta::CPAN
my Gearman::Task $task = shift;
my $try_again;
$try_again = sub {
my @job_servers = grep { $_->alive } @{$self->{job_servers}};
warn "Alive servers: " . @job_servers . " out of " . @{$self->{job_servers}} . "\n" if DEBUGGING;
unless (@job_servers) {
$task->final_fail;
$try_again = undef;
return;
view all matches for this distribution
view release on metacpan or search on metacpan
t/gearman.t view on Meta::CPAN
my $opts = { 'die_upon_destroy' => 1 };
my $proc = Proc::Background->new( $opts, $command );
sleep( 1 );
unless( $proc->alive ) {
$proc = undef;
die "Process '$command' failed to start.";
}
return $proc;
view all matches for this distribution
view release on metacpan or search on metacpan
bin/gearmand view on Meta::CPAN
use vars qw($DEBUG);
$DEBUG = 0;
my ($daemonize, $nokeepalive, $notify_pid, $opt_pidfile, $accept, $wakeup,
$wakeup_delay, $conf_host,);
my $conf_port = 4730;
Getopt::Long::GetOptions(
'd|daemonize' => \$daemonize,
view all matches for this distribution
view release on metacpan or search on metacpan
t/02-supervisor.t view on Meta::CPAN
servers => [Gearman::Spawner::Server->address],
workers => { },
);
my $pid = $spawner->pid;
ok(kill(0, $pid), 'supervisor is alive');
my $timed_out = 0;
$SIG{ALRM} = sub { $timed_out++ };
alarm 1;
undef $spawner;
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-server.t view on Meta::CPAN
my @urls : shared = (); # workers report back here
my @labels : shared = (); # workers report task labels here
my $work_cnt : shared = 0;
my $work_drop : shared = 0;
my $alives : shared = 0;
sub run_experiment {
my $deps = shift;
t/01-server.t view on Meta::CPAN
$work_drop = 0;
warn "== MAIN: $o{nr_workers} =====================================================================================";
my @workers = map { threads->new(\&Worker::run, "W$_", $o{worker}) } (1.. $o{nr_workers});
map { $_->detach } @workers;
$alives = scalar @workers;
$d->evolve ($o{kick});
my $start_time = time;
my $end_time = $start_time + $o{max_time}; # we plan to work at most some secs on that
t/01-server.t view on Meta::CPAN
warn "MAIN: STRANGE got $url in queue which is not known in Petri";
next RESPONSE;
}
$d->evolve ($url);
}
warn "MAIN: sleeping a bit with alive $alives";
sleep 1;
# $d->evolve ('xxx') if time > $end_time - $loop_time + 2; # 2 secs after start we pretend something else happened
@gearmandized = grep { $_->{gearmandized}->[0] } map { $d->things ($_) } $d->transitions;
view all matches for this distribution
view release on metacpan or search on metacpan
bin/create_db.PL view on Meta::CPAN
MaxAge => 30 * 24
}) || die "$0: $cache_dir: $!";
print "This will take some time. It'd be best to go and make yourself a cup of tea.\n";
my $ua = $force_flag ? LWP::UserAgent->new(timeout => 60, keep_alive => 1) : LWP::UserAgent::WithCache->new(timeout => 60, keep_alive => 1);
# my $ua = LWP::UserAgent->new(timeout => 60, keep_alive => 1);
$ua->env_proxy(1);
$ua->agent('Mozilla/5.0');
$ua->conn_cache()->total_capacity(undef);
$Lingua::EN::NameCase::POSTNOMINAL = 0;
view all matches for this distribution
view release on metacpan or search on metacpan
bin/create_db.PL view on Meta::CPAN
MaxAge => 30 * 24
}) || die "$0: $cache_dir: $!";
print "This will take some time. It'd be best to go and make yourself a cup of tea.\n";
my $ua = LWP::UserAgent::WithCache->new(timeout => 60, keep_alive => 1);
$ua->env_proxy(1);
$ua->agent('Mozilla/5.0');
$ua->conn_cache()->total_capacity(undef);
$Lingua::EN::NameCase::POSTNOMINAL = 0;
view all matches for this distribution
view release on metacpan or search on metacpan
bin/create_db.PL view on Meta::CPAN
MaxAge => 30 * 24
}) || die "$0: $cache_dir: $!";
# print "This will take some time. It'd be best to go and make yourself a cup of tea.\n";
my $ua = LWP::UserAgent::WithCache->new(timeout => 10, keep_alive => 1);
$ua->env_proxy(1);
$ua->agent('Mozilla/5.0');
$ua->conn_cache()->total_capacity(undef);
$Lingua::EN::NameCase::POSTNOMINAL = 0;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Geneos/API.pm view on Meta::CPAN
# XML-RPC API options:
raise_error => 1,
},
ua => {
# UserAgent options:
keep_alive => 20,
timeout => 60,
},
});
=head4 B<api> - XML-RPC options
lib/Geneos/API.pm view on Meta::CPAN
=item * C<< any options supported by L<LWP::UserAgent> >>
=back
If no LWP::UserAgent options are passed to the constructor, the keep alive will be enabled with the total capacity of 10. In other words, the two calls below are identical:
$api = Geneos::API->new("http://localhost:7036/xmlrpc")
# is identical to
$api = Geneos::API->new("http://localhost:7036/xmlrpc", {
ua => {
keep_alive => 10,
},
});
# but different to (keep alive disabled):
$api = Geneos::API->new("http://localhost:7036/xmlrpc", {
ua => {},
});
Note that if you pass the LWP::UserAgent options, the keep alive default won't be applied:
# keep alive is not enabled
$api = Geneos::API->new("http://localhost:7036/xmlrpc", {
ua => {
timeout => 300,
},
});
Examples:
# sets http timeout to 30 seconds and implicitly disables keep alive:
$api = Geneos::API->new("http://example.com:7036/xmlrpc", {
ua => {
timeout=>30,
},
});
lib/Geneos/API.pm view on Meta::CPAN
#
# * '-', '(' and ')' characters may be used in the method names
# * the values do not default to type 'string'
#
# Among other reasons, ensuring that HTTP1.1 is used to take advantage
# of the keep alive feature supported by Geneos XML-RPC server
#
########################################################################
package Geneos::API::XMLRPC;
lib/Geneos/API.pm view on Meta::CPAN
else {
# init the options
$opts ||= {};
}
# enable keep alive by default
$opts->{ua} ||= {keep_alive=>DEFAULT_TOTAL_CAPACITY,};
# no api options are set by default
$opts->{api} ||= {};
$self->{_xmlrpc} = Geneos::API::XMLRPC->new($url, $opts);
view all matches for this distribution
view release on metacpan or search on metacpan
corpus/distmap.json view on Meta::CPAN
"versions_gentoo" : [
"1.051"
]
}
],
"POE-Component-Client-Keepalive" : [
{
"category" : "dev-perl",
"package" : "POE-Component-Client-Keepalive",
"repository" : "perl-experimental",
"versions_gentoo" : [
"0.271.0"
]
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/sandbox/usr/portage/app-shells/csh/files/mksignames.c view on Meta::CPAN
#if defined (SIGGRANT) /* HFT monitor mode granted */
signal_names[SIGGRANT] = "SIGGRANT";
#endif
#if defined (SIGKAP) /* keep alive poll from native keyboard */
signal_names[SIGKAP] = "SIGKAP";
#endif
#if defined (SIGRETRACT) /* HFT monitor mode retracted */
signal_names[SIGRETRACT] = "SIGRETRACT";
view all matches for this distribution
view release on metacpan or search on metacpan
t/sample.gpx view on Meta::CPAN
</groundspeak:log>
<groundspeak:log id="1587729">
<groundspeak:date>2003-06-21T07:00:00</groundspeak:date>
<groundspeak:type>Didn't find it</groundspeak:type>
<groundspeak:finder id="27639">RGS</groundspeak:finder>
<groundspeak:text encoded="False">Now I know why this is called Skeeter Mtn. We got here just about dark and we were eaten alive. We searched the 2 obvious areas based on the hint and came up with nothing, just like the previous 2 cachers. ...
RGS
St. Louis</groundspeak:text>
</groundspeak:log>
<groundspeak:log id="1471480">
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Geo/Cloudmade.pm view on Meta::CPAN
=cut
sub new {
my ($class, $key) = @_;
bless {
key => $key,
ua => LWP::UserAgent->new( keep_alive => 2 ),
error => '',
http_status => 0,
}, $class
}
view all matches for this distribution
view release on metacpan or search on metacpan
createdatabase.PL view on Meta::CPAN
my $current_state;
my $current_country;
# my %whosonfirst;
my $ua = LWP::UserAgent::Throttled->new(keep_alive => 1);
$ua->conn_cache(LWP::ConnCache->new());
$ua->throttle({ 'api.zippopotam.us' => 1 });
$ua->env_proxy(1);
$filename = 'downloads/allCountries.txt';
view all matches for this distribution
view release on metacpan or search on metacpan
US/Import.pm view on Meta::CPAN
it might be faster for you to just download a binary version of the
fully imported database.
Right now, I can't afford to make the full 750 megabyte database freely
downloadable from my website -- the bandwidth charges would eat me
alive. Contact me if you can offer funding or mirroring.
=head1 SEE ALSO
Geo::Coder::US(3pm), Geo::StreetAddress::US(3pm), Geo::TigerLine(3pm),
Geo::Fips55(3pm), DB_File(3pm), Archive::Zip(3pm)
view all matches for this distribution
view release on metacpan or search on metacpan
GDAL maintains its own reference counting but this is largely lost in
the bindings.
The Perl bindings attempt to maintain these dependencies by keeping
the parent objects alive under the hood, independent of their existence
in the user space. Thus it is perfectly legal to do something like
\code
my $layer = Geo::OGR::Driver('Memory')->
Create()->
view all matches for this distribution
view release on metacpan or search on metacpan
share/icao.data view on Meta::CPAN
LFIM|Saint-Gaudens Montrejeau Airport|Saint-Gaudens
LFIO|Toulouse-Montaudran Airport|Toulouse-Montaudran
LFIP|Peyresourde Balestas Airport|Peyresourde
LFIR|Revel Montgey Airport|Revel
LFIT|Toulouse Bourg-Saint-Bernard Airport|Toulouse
LFIV|Vendays-Montalivet Airport|Vendays-Montalivet
LFIX|Itxassou Airport|Itxassou
LFIY|Saint-Jean-d'Angély Airport|Saint-Jean-d'Angély
LFJA|Chaumont Semoutiers Airport|Chaumont
LFJB|Mauléon Airport|Mauléon
LFJC|Clamecy Airport|Clamecy
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Geo/Routing/Role/Driver.pm view on Meta::CPAN
);
$mech->default_header(
'Accept-Encoding' => "gzip,deflate",
'Keep-Alive' => "300",
'Connection' => "keep-alive",
);
return $mech;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Gepok.pm view on Meta::CPAN
# response and send it to client.
sub _finalize_response {
my($self, $env, $res, $sock) = @_;
if ($env->{'psgix.harakiri.commit'}) {
$self->{_client_keepalive} = 0;
$self->{_client_harakiri} = 1;
}
my $server_proto = $env->{SERVER_PROTOCOL};
my $client_proto = $self->{_client_proto};
lib/Gepok.pm view on Meta::CPAN
if (!$headers{date}) {
push @headers, "Date: " . time2str(time());
}
my $keepalive;
if ($env->{HTTP_CONNECTION}) {
$keepalive = $env->{HTTP_CONNECTION} =~ /alive/i ? 1:0;
}
# default is keep-alive for HTTP/1.1, but close for HTTP/1.0
$keepalive //= ($client_proto eq 'HTTP/1.1' ? 1:0);
# normally HTTP::Daemon prints this, but we're not sending response using
# HTTP::Daemon
push @headers, "Connection: ".($keepalive ? "Keep-Alive" : "Close");
my $chunked;
my $cl = $headers{'content-length'};
if ($client_proto eq 'HTTP/1.1') {
if ($status =~ /^[123]/ && $status != 304 && (!defined($cl) || $cl)) {
lib/Gepok.pm view on Meta::CPAN
$chunked = 0;
}
push @headers, "Transfer-Encoding: chunked" if $chunked;
$self->{_chunked} = $chunked;
#warn "chunked=$chunked, keep-alive=$keepalive, client_proto=$client_proto";
if ($client_proto le 'HTTP/1.0' && $keepalive && !defined($cl)) {
# if HTTP/1.0 client requests keep-alive (like Wget), we need
# Content-Length so client knows when response ends.
# produce body first so we can calculate content-length
$self->_finalize_body($env, $res, $sock, 1);
push @headers, "Content-Length: ".$self->{_res_content_length};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Gerrit/Client.pm view on Meta::CPAN
}
if ( !$status && $options->{on_success} ) {
$options->{on_success}->();
}
# make sure we stay alive until this callback is executed
undef $cv;
}
);
return;
lib/Gerrit/Client.pm view on Meta::CPAN
$cmdstr = "[@cmd]";
}
$cv->cb(
sub {
# make sure we stay alive until this callback is executed
undef $cv;
my $status = shift->recv();
if ( $status && $options{on_error} ) {
$options{on_error}->("$cmdstr exited with status $status");
view all matches for this distribution