view release on metacpan or search on metacpan
lib/DBIx/XHTML_Table.pm view on Meta::CPAN
# note: disconnected handles aren't caught :(
if (UNIVERSAL::isa($_[0],'DBI::db')) {
# use supplied db handle
$self->{'dbh'} = $_[0];
$self->{'keep_alive'} = 1;
}
elsif (ref($_[0]) eq 'ARRAY') {
# go ahead and accept a pre-built 2d array ref
$self->_do_black_magic(@_);
}
lib/DBIx/XHTML_Table.pm view on Meta::CPAN
}
# disconnect database handle if i created it
sub DESTROY {
my ($self) = @_;
unless ($self->{'keep_alive'}) {
$self->{'dbh'}->disconnect if defined $self->{'dbh'};
}
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
- The File back end now supports Unicode. This is only supported
for new databases. Old databases in the DBM::Deep 1.0003 format
will have to be upgraded for this to work.
- New external_refs mode, which allows objects retrieved from the
database to hang on to the corresponding database entries, keep-
ing them alive, even after all references to them from the data-
base itself have been deleted.
- Numeric comparison of DBM::Deep objects now works. Different
objects used to compare equal. And there were uninitial-
ized warnings.
- Deletions now work properly in the DBI back end. Deleting an
view all matches for this distribution
view release on metacpan or search on metacpan
t/02_network_basic.t view on Meta::CPAN
ok(defined $network, "new() works");
ok($network->isa("AI::ANN"), "Right class");
ok($network->isa("DCOLLINS::ANN::Robot"), "Right class");
ok($out=$network->execute([1]), "executed and still alive");
is($#{$out}, 4, "execute() output for a single neuron is the right length");
($inputs, $neurons, $outputs) = $network->get_state();
is($#{$inputs}, 0, "get_state inputs is correct length");
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DDLock/Server.pm view on Meta::CPAN
use IO::Socket::INET;
use Socket qw(IPPROTO_TCP SO_KEEPALIVE TCP_NODELAY SOL_SOCKET);
# Linux-specific:
use constant TCP_KEEPIDLE => 4; # Start keeplives after this period
use constant TCP_KEEPINTVL => 5; # Interval between keepalives
use constant TCP_KEEPCNT => 6; # Number of keepalives before death
sub new {
my $class = shift;
my %args = @_;
lib/DDLock/Server.pm view on Meta::CPAN
return unless $csock;
IO::Handle::blocking($csock, 0);
setsockopt($csock, IPPROTO_TCP, TCP_NODELAY, pack("l", 1)) or die;
# Enable keep alive
unless ( $args{nokeepalive} ) {
(setsockopt($csock, SOL_SOCKET, SO_KEEPALIVE, pack("l", 1)) &&
setsockopt($csock, IPPROTO_TCP, TCP_KEEPIDLE, pack("l", 30)) &&
setsockopt($csock, IPPROTO_TCP, TCP_KEEPCNT, pack("l", 10)) &&
setsockopt($csock, IPPROTO_TCP, TCP_KEEPINTVL, pack("l", 30)) &&
1
) || die "Couldn't set keep-alive settings on socket (Not on Linux?)";
}
my $client = $client_class->new($csock);
$client->watch_read(1);
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DJabberd/Connection.pm view on Meta::CPAN
$bref = $self->read(20_000);
}
return $self->close unless defined $bref;
# clients send whitespace between stanzas as keep-alives. let's just ignore those,
# not going through the bother to checkout a parser and all.
return if ! $self->{parser} && $$bref !~ /\S/;
Carp::confess if ($self->{closed});
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DMTF/WSMan.pm view on Meta::CPAN
$self->{Context}{user} = $args{user} if(defined $args{user});
$self->{Context}{port} = $args{port} if(defined $args{port});
$self->{Context}{protocol} = $args{protocol} if(defined $args{protocol});
$self->{Context}{pass} = $args{pass} if(defined $args{pass});
$self->{Context}{host} = $args{host} if(defined $args{host});
$self->{RA} = DMTF::WSMan::PRIVATE::RequestAgent->new($self, keep_alive=>1);
$self->{challenge_str}=undef;
$self->{UUID} = Data::UUID->new();
bless($self, $self->{CLASS});
return($self);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DNS/Unbound.pm view on Meta::CPAN
of this class: wait for that file descriptor to be readable, then
call this classâs C<perform()> method.
=head1 MEMORY LEAK DETECTION
Objects in this namespace will, if left alive at global destruction,
throw a warning about memory leaks. To silence these warnings, either
allow all queries to complete, or cancel queries you no longer care about.
=head1 ERRORS
view all matches for this distribution
view release on metacpan or search on metacpan
t/010-tarantool-1.5/000-queue.t view on Meta::CPAN
{ type => 'NUM', name => 'ctaken' },
{ type => 'NUM64', name => 'now' },
]
);
cmp_ok $meta->now, '<', $meta->ttl + $meta->created, 'task is alive';
is $meta->ttl, 10000000, 'ttl';
is $meta->ttr, 20000000, 'ttr';
is_deeply $task1, [ $task1->[0], 'tube_name', 'ready', 'task', 1 .. 10 ],
'task 1';
view all matches for this distribution
view release on metacpan or search on metacpan
CAB/Server/HTTP.pm view on Meta::CPAN
##-- setup SIGPIPE handler (avoid heinous death)
## + following suggestion on http://www.perlmonks.org/?node_id=580411
$SIG{PIPE} = sub { ++$srv->{nErrors}; $srv->vlog('warn',"got SIGPIPE (ignoring)"); };
##-- HACK: set HTTP::Daemon protocol to HTTP 1.0 (avoid keepalive)
$HTTP::Daemon::PROTO = "HTTP/1.0";
my ($csock,$chost,$hreq,$urikey,$forkable,$cacheable,$handler,$localPath,$pid,$rsp);
my ($fdset);
while (1) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DWH_File/Kernel.pm view on Meta::CPAN
my $self = { dbm => $dbm,
file => $file,
cache => DWH_File::Cache->new,
garbage => {},
dummy => \%dummy,
alive => 1,
};
bless $self, $class;
$self->{ id_mill } = DWH_File::ID_Mill->new( $self, 'id_mill' );
$self->{ id_mill }{ current } ||= 0;
$self->{ uri_pool } = DWH_File::Registry::URI->new( $self, 'uri_pool' );
lib/DWH_File/Kernel.pm view on Meta::CPAN
sub release {
my ( $self ) = @_;
$self->{ uri_pool }->release( $self );
delete $_[ 0 ]->{ dbm };
untie %{ $_[ 0 ]->{ dummy } };
$self->{ alive } = 0;
}
sub wipe {
my ( $self ) = @_;
$self->save_state;
view all matches for this distribution
view release on metacpan or search on metacpan
t/10-hot_standby.t view on Meta::CPAN
ok $out = get_command_output( "$^X -I$ilib $file restart" ), "Get status of system daemon.";
like $out, qr/\[Found existing.*\[Started\]/ms, "Daemon restarted.";
my $next_pid = current_pid();
ok $out = get_command_output( "$^X -I$ilib $file status" ), "Get status of system daemon.";
# not sure how to check that $start_pid is still alive for a period of time before being killed at this stage.
isnt $start_pid, $next_pid, "pid file contents swapped";
like $out, qr/\[Running\]/, "Daemon running after restart.";
ok $out = get_command_output( "$^X -I$ilib $file stop" ), "Get status of system daemon.";
like $out, qr/\[Stopped\]/, "Daemon stopped after restart.";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Daemon/Device.pm view on Meta::CPAN
if ( $self->{_child} ) {
$self->{_child}->($self);
}
else {
while (1) {
exit unless ( $self->parent_alive );
sleep 1;
}
}
return;
lib/Daemon/Device.pm view on Meta::CPAN
my $self = shift;
$self->{_parent_hup_to_child} = $_[0] if (@_);
return $self->{_parent_hup_to_child};
}
sub parent_alive {
my ($self) = @_;
return kill( 0, $self->{_ppid} );
}
sub data {
lib/Daemon/Device.pm view on Meta::CPAN
sub child {
my ($device) = @_;
while (1) {
warn "Child $$ exists (heartbeat)\n";
exit unless ( $device->parent_alive );
sleep 5;
}
}
=head1 DESCRIPTION
lib/Daemon/Device.pm view on Meta::CPAN
child => sub {
my ($device) = @_;
while (1) {
warn "Child $$ exists (heartbeat)\n";
exit unless ( $device->parent_alive );
sleep 5;
}
},
)->run;
lib/Daemon/Device.pm view on Meta::CPAN
C<parent_hup_to_child> values, allowing you to change them during runtime.
This should be done in parents. Remember that data values are copied into
children during spawning (i.e. forking), so changing these values in children
is meaningless.
=head2 parent_alive
The C<parent_alive> method returns true if the daemon parent still lives or
false if it doesn't live. This is useful when writing child code, since a child
should periodically check to see if it's an orphan.
exit Daemon::Device->new(
daemon => \%daemon_control_settings,
child => sub {
my ($self) = @_;
while (1) {
exit unless ( $self->parent_alive );
sleep 1;
}
},
)->run;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Daemon/Easy.pm view on Meta::CPAN
=head1 SYNOPSIS
use Daemon::Easy sleep=>5, stopfile=>'stop', pidfile=>'pid', callback=>'worker';
sub worker{
print "i am alive\n";
}
run();
in the shell:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Daemon/Generic/While1.pm view on Meta::CPAN
#
# We'll be getting a SIGTERM in a bit if we're not dead, so let's use it.
#
$SIG{TERM} = sub {
$self->gd_quit_event();
kill(15, $child) if $child; # if we're still alive, let's stay that way
};
};
}
sub gd_sleep
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer/Plugin/Database/Core.pm view on Meta::CPAN
return bless($dbh => $handle_class);
}
# Check the connection is alive
sub _check_connection {
my $dbh = shift;
return unless $dbh;
if ($dbh->{Active}) {
my $result = eval { $dbh->ping };
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer/Plugin/Database.pm view on Meta::CPAN
to do with DBI, but also adds a few convenience methods. See the documentation
for L<Dancer::Plugin::Database::Core::Handle> for full details of those.
Takes care of ensuring that the database handle is still connected and valid.
If the handle was last asked for more than C<connection_check_threshold> seconds
ago, it will check that the connection is still alive, using either the
C<< $dbh->ping >> method if the DBD driver supports it, or performing a simple
no-op query against the database if not. If the connection has gone away, a new
connection will be obtained and returned. This avoids any problems for
a long-running script where the connection to the database might go away.
view all matches for this distribution
view release on metacpan or search on metacpan
. add Dancer dependancy
. get Makefile.PL properly generated
0.306 2011-01-28 16:15:49 Europe/Paris
. Fix RT#65009 again
. flash messages are now smart enough to stay alive across multiple
requests, until they are used in templates ( thanks to Flavio Poletti
for the idea )
0.305 2011-01-23 19:20:17 Europe/Paris
. Fix RT#65009
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer/Plugin/LDAP.pm view on Meta::CPAN
$ldap->{dancer_settings} = $settings;
return bless $ldap, 'Dancer::Plugin::LDAP::Handle';
}
# Check whether the connection is alive
sub _check_connection {
my $ldap = shift;
return unless $ldap;
return unless $ldap->socket;
return 1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer/Plugin/MPD.pm view on Meta::CPAN
=head1 DESCRIPTION
Provides an easy way to connect to MPD (L<www.musicpd.org>) from a L<Dancer>
app. Handles obtaining the connection, making sure the connection is still
alive, and reconnecting if not.
=head1 SYNOPSIS
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer/Plugin/Mango.pm view on Meta::CPAN
execute_hook('database_connected', $dbh);
return $dbh;
}
# Check the connection is alive
sub _check_connection {
my $dbh = shift;
return unless $dbh;
my $curs;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer/Plugin/MongoDB.pm view on Meta::CPAN
execute_hook('database_connected', $dbh);
return $dbh;
}
# Check the connection is alive
sub _check_connection {
my $dbh = shift;
return unless $dbh;
my $curs;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer/Plugin/StreamData.pm view on Meta::CPAN
my $psgi_callback = shift;
# Use the callback we were given to procure a writer object, and in the
# process pass the status and headers stored by prepare_stream() above.
# This will cause the HTTP response to be emitted, with a keep-alive
# header so that the client will know to wait for more data to come.
my $writer = $psgi_callback->( [ $stream_status, \@stream_headers ] );
# Now we call the routine specified in the original call to stream_data.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer/Request.pm view on Meta::CPAN
use URI;
use URI::Escape;
my @http_env_keys = (
'user_agent', 'accept_language', 'accept_charset',
'accept_encoding', 'keep_alive', 'connection', 'accept',
'accept_type', 'referer', #'host', managed manually
);
my $count = 0;
__PACKAGE__->attributes(
lib/Dancer/Request.pm view on Meta::CPAN
$self->{user_agent} = $env->{HTTP_USER_AGENT};
$self->{host} = $env->{HTTP_HOST};
$self->{accept_language} = $env->{HTTP_ACCEPT_LANGUAGE};
$self->{accept_charset} = $env->{HTTP_ACCEPT_CHARSET};
$self->{accept_encoding} = $env->{HTTP_ACCEPT_ENCODING};
$self->{keep_alive} = $env->{HTTP_KEEP_ALIVE};
$self->{connection} = $env->{HTTP_CONNECTION};
$self->{accept} = $env->{HTTP_ACCEPT};
$self->{accept_type} = $env->{HTTP_ACCEPT_TYPE};
$self->{referer} = $env->{HTTP_REFERER};
$self->{x_requested_with} = $env->{HTTP_X_REQUESTED_WITH};
lib/Dancer/Request.pm view on Meta::CPAN
=item C<host>
If you app is on a non-standard port, you can expect this to return the hostname
and port, e.g. C<example.com:5000>.
=item C<keep_alive>
=item C<path_info>
=item C<referer>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer2/Plugin/Database.pm view on Meta::CPAN
to do with DBI, but also adds a few convenience methods. See the documentation
for L<Dancer::Plugin::Database::Core::Handle> for full details of those.
Takes care of ensuring that the database handle is still connected and valid.
If the handle was last asked for more than C<connection_check_threshold> seconds
ago, it will check that the connection is still alive, using either the
C<< $dbh->ping >> method if the DBD driver supports it, or performing a simple
no-op query against the database if not. If the connection has gone away, a new
connection will be obtained and returned. This avoids any problems for
a long-running script where the connection to the database might go away.
view all matches for this distribution
view release on metacpan or search on metacpan
CREATE_SAMPLE_APPLICATION view on Meta::CPAN
If you use an nginx web server to reverse proxy you service your app
vi nginx.conf
...
upstream TestService { server 127.0.0.1:3000 fail_timeout=0; keepalive 1024; }
...
server
{
server_name www.example.com;
listen 30080;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer2/Core/Request.pm view on Meta::CPAN
my @http_env_keys = (qw/
accept_charset
accept_encoding
accept_language
connection
keep_alive
x_requested_with
/);
# apparently you can't eval core functions
sub accept { $_[0]->env->{'HTTP_ACCEPT'} }
lib/Dancer2/Core/Request.pm view on Meta::CPAN
C<HTTP_X_FORWARDED_HOST>, since this is a comma separated list.
If you have not configured that you are behind a proxy, it returns HTTP
header C<HTTP_HOST>.
=item C<keep_alive>
HTTP header: C<HTTP_KEEP_ALIVE>.
=item C<referer>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Danga/Socket/AnyEvent.pm view on Meta::CPAN
$cancel->();
};
$timer->[0] = $cancel;
# We save the watcher in $Timers to keep it alive until it runs,
# or until $cancel above overwrites it with undef to cause it to
# get collected.
$Timers{$key} = AnyEvent->timer(
after => $secs,
cb => _wrap_watcher_cb($cb),
view all matches for this distribution
view release on metacpan or search on metacpan
t/25_alias_weakref.t view on Meta::CPAN
skip "Scalar::Util not installed", 4
unless eval "use Scalar::Util qw/ weaken /; 42";
my $x = {};
my $y = {};
my $keepalive = $x;
weaken($x);
alias $x->{foo} = $y->{foo};
$x->{foo} = 42;
undef $keepalive;
is $x, undef;
is $y->{foo}, 42;
$x = [];
$keepalive = $x;
weaken($x);
alias push @$x, $y;
$y = 42;
is "@$keepalive", 42;
undef $keepalive;
is $x, undef;
}
# vim: ft=perl
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/AnyXfer/Elastic/Import/File/Simple.pm view on Meta::CPAN
# make sure it deserialises to an array ref
return $value = [@{$self->format->deserialise($value)}]
if $value;
# if we're still alive here
# we don't have a value, so the item must be new or empty
# so just return a ref to an empty array
# (but "touch" the item so it exists if we may need to write)
unless ($self->storage->read_only) {
$self->storage->set_item($from_item, $self->format->serialise([]));
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Apache/mod_status/2XML.pm view on Meta::CPAN
<xsl:variable name="workers" select="/x:html/x:body/x:pre[1]/text()" />
<waiting><xsl:value-of select="string-length(translate($workers, translate($workers, '_', ''), ''))" /></waiting>
<starting><xsl:value-of select="string-length(translate($workers, translate($workers, 'S', ''), ''))" /></starting>
<reading><xsl:value-of select="string-length(translate($workers, translate($workers, 'R', ''), ''))" /></reading>
<sending><xsl:value-of select="string-length(translate($workers, translate($workers, 'W', ''), ''))" /></sending>
<keepalive><xsl:value-of select="string-length(translate($workers, translate($workers, 'K', ''), ''))" /></keepalive>
<dns_lookup><xsl:value-of select="string-length(translate($workers, translate($workers, 'D', ''), ''))" /></dns_lookup>
<closing><xsl:value-of select="string-length(translate($workers, translate($workers, 'C', ''), ''))" /></closing>
<logging><xsl:value-of select="string-length(translate($workers, translate($workers, 'L', ''), ''))" /></logging>
<finishing><xsl:value-of select="string-length(translate($workers, translate($workers, 'G', ''), ''))" /></finishing>
<idle_cleanup><xsl:value-of select="string-length(translate($workers, translate($workers, 'I', ''), ''))" /></idle_cleanup>
view all matches for this distribution