view release on metacpan or search on metacpan
lib/Glib/Ex/FreezeNotify.pm view on Meta::CPAN
FreezeNotify works by having C<thaw_notify()> in the destroy code of the
FreezeNotify object.
FreezeNotify only holds weak references to its objects, so the mere fact
they're due for later thawing doesn't keep them alive if nothing else cares
whether they live or die. The effect is that frozen objects can be garbage
collected within a freeze block at the same point they would be without any
freezing, instead of extending their life to the end of the block.
It works to have multiple freeze/thaws, done either with FreezeNotify or
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Glib/Object/Introspection.pm view on Meta::CPAN
=head2 Memory Handling
The functions for ref'ing and unref'ing objects and free'ing boxed structures
are not even mapped to Perl, because it's all handled automagically by the
bindings. Objects will be kept alive so long as you have a Perl scalar
pointing to it or the object is referenced in another way, e.g. from a
container.
The only thing you have to be careful about is the lifespan of non
reference counted structures, which means most things derived from
view all matches for this distribution
view release on metacpan or search on metacpan
xs/DiaCanvasItem.xs view on Meta::CPAN
if (!g_type_is_a (type, DIA_TYPE_CANVAS_ITEM))
croak ("%s(%s) is not a DiaCanvasItem",
package, g_type_name (type));
/* peek should suffice, as the bindings should keep this class
* alive for us. */
class = g_type_class_peek (type);
if (!class)
croak ("internal problem: can't peek at type class for %s(%d)",
g_type_name (type), type);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBD/Gofer/Transport/http.pm view on Meta::CPAN
$request;
};
my $http_ua = $self->{http_ua} ||= do {
my $useragent = LWP::UserAgent->new(
timeout => $self->go_timeout, # undef by default
keep_alive => $CONN_CACHE, # sets total_capacity of LWP::ConnCache
env_proxy => 1, # XXX
);
$useragent->agent(join "/", __PACKAGE__, $DBI::VERSION, $VERSION);
#$useragent->credentials( $netloc, $realm, $uname, $pass ); XXX
$useragent->parse_head(0); # don't parse html head
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Goo/CareOMeter.pm view on Meta::CPAN
select title, bugid, importance,
date_format(foundon, '%d %b %Y') as 'foundon',
description
from bug
where status = 'alive'
order by importance desc, foundon desc
limit $BUFFER_SIZE
EOSQL
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Google/Directions/Client.pm view on Meta::CPAN
=head1 ATTRIBUTES
=over 4
=item I<keep_alive> Enable keep_alive for the user agent.
B<Warning:> This causes occasional errors due to partial content being returned... I'm not sure
what the root cause for this is... :(
=item I<user_agent> Define a custom L<LWP::UserAgent> if you like.
lib/Google/Directions/Client.pm view on Meta::CPAN
=back
=cut
has 'keep_alive' => ( is => 'ro', isa => 'Int', required => 1, default => 0 );
has 'user_agent' => (
is => 'ro',
isa => 'LWP::UserAgent',
writer => '_set_user_agent',
lib/Google/Directions/Client.pm view on Meta::CPAN
# Create a LWP::UserAgent if necessary
around 'user_agent' => sub {
my $orig = shift;
my $self = shift;
unless( $self->_has_user_agent ){
if( $self->keep_alive and not $ENV{NO_WARN_KEEPALIVE} ){
carp( "Warning - keep_alive gives unreliable results - partial JSON returned\n" .
"Set the enviroment variable NO_WARN_KEEPALIVE to hide this warning\n" );
}
my $ua = LWP::UserAgent->new(
'keep_alive' => $self->keep_alive,
);
$self->_set_user_agent( $ua );
}
return $self->$orig;
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Google/Fusion.pm view on Meta::CPAN
=item * access_token <Str>
A temporary access token aquired during the authorization process
Can be defined here, otherwise it will be aquired during the authorization process
=item * keep_alive <Int>
Use keep_alive for connections - this will make the application /much/ more responsive.
Default: 1
=item * headers <Bool>
lib/Google/Fusion.pm view on Meta::CPAN
has 'access_token' => ( is => 'ro', isa => 'Str', );
has 'access_code' => ( is => 'ro', isa => 'Str', );
has 'query_cache' => ( is => 'ro', isa => 'Str', );
has 'token_store' => ( is => 'ro', isa => 'Str', );
has 'headers' => ( is => 'ro', isa => 'Bool', required => 1, default => 1, );
has 'keep_alive' => ( is => 'ro', isa => 'Bool', required => 1, default => 1, );
has 'auth_client' => ( is => 'ro', required => 1, lazy => 1,
isa => 'Net::OAuth2::Moosey::Client',
builder => '_build_auth_client',
);
has 'insert_buffer' => ( is => 'rw', isa => 'Str', clearer => 'clear_insert_buffer', default => sub{ '' } );
lib/Google/Fusion.pm view on Meta::CPAN
site_url_base => 'https://accounts.google.com/o/oauth2/auth',
access_token_url_base => 'https://accounts.google.com/o/oauth2/token',
authorize_url_base => 'https://accounts.google.com/o/oauth2/auth',
scope => 'https://www.google.com/fusiontables/api/query',
);
foreach( qw/client_id client_secret refresh_token access_code access_token keep_alive token_store/ ){
$client_params{$_} = $self->$_ if defined $self->$_;
}
# $self->logger->debug( "Initialising Client with:\n". Dump( \%client_params ) );
my $client = Net::OAuth2::Moosey::Client->new( %client_params );
view all matches for this distribution
view release on metacpan or search on metacpan
t/unit/Test/Google/RestApi.pm view on Meta::CPAN
require File::Spec;
$dir //= File::Spec->catdir($FindBin::RealBin, 'etc');
my $fh = File::Temp->new(SUFFIX => '.yaml', DIR => $dir, UNLINK => 1);
print $fh YAML::Any::Dump($data);
$fh->flush();
push @_temp_configs, $fh; # keep object alive; deleted at program end
return $fh->filename();
}
sub auth : Tests(4) {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Google/gRPC/Channel.pm view on Meta::CPAN
has target => ( is => 'ro', required => 1 );
has auth_token => ( is => 'ro', required => 0 );
has engine_type => ( is => 'ro', required => 0 );
has timeout => ( is => 'ro', required => 0 );
has keepalive_time_sec => ( is => 'ro', required => 0 );
has keepalive_timeout_sec => ( is => 'ro', required => 0 );
has engine => ( is => 'rw' );
has streams => ( is => 'rw', default => sub { {} } );
has last_activity_time => ( is => 'rw', default => sub { time() } );
sub BUILD {
lib/Google/gRPC/Channel.pm view on Meta::CPAN
$self->engine->send_ping($cb);
}
$self->last_activity_time(time());
}
sub check_keepalive {
my ($self) = @_;
return unless defined $self->keepalive_time_sec;
my $now = time();
if ($now - $self->last_activity_time >= $self->keepalive_time_sec) {
$self->send_ping();
}
}
sub check_deadlines {
view all matches for this distribution
view release on metacpan or search on metacpan
examples/hog-fetch-all.pl view on Meta::CPAN
# No cookies so get a fresh search each time.
# Or could increment the historyIndex parameter to mean start new search.
# Would that be better, worse, or same?
#
my $mech = WWW::Mechanize->new (keep_alive => 1,
cookie_jar => undef);
$mech->agent("$FindBin::Script/$VERSION ".$mech->agent);
# ask for all compressions decoded_content() knows
$mech->add_header('Accept-Encoding' => scalar HTTP::Message::decodable());
view all matches for this distribution
view release on metacpan or search on metacpan
t/02_Aesthetic.t view on Meta::CPAN
nearly($aglo->temperature, 1e2, "Default temperature is 1e2");
nearly($aglo->end_temperature, 1e-3, "Default end_temperature is 1e-3");
is($aglo->iterations, 1e3, "Default temperature is 1e3");
is($aglo->topology, $topo3, "Topology is available");
$topo3 = undef;
is($topo_destroys, 0, "aglo keeps topology alive");
$force_destroys = 0;
my $force = Graph::Layout::Aesthetic::Force::NodeRepulsion->new;
is($force_destroys, 0, "The force is alive");
$aglo->_add_force($force);
is($force_destroys, 0, "The force is alive");
$force = undef;
is($force_destroys, 0, "The force is alive");
$destroys = 0;
$aglo = undef;
is($destroys, 1, "Cleanup on last reference");
is($topo_destroys, 1, "Toplogy Cleanup on last reference");
is($force_destroys, 1, "The force is gone");
t/02_Aesthetic.t view on Meta::CPAN
is($aglo->nr_dimensions, 2, "Undef means two dimensions");
$force_destroys = 0;
$force = Graph::Layout::Aesthetic::Force::NodeRepulsion->new;
$aglo->_add_force($force);
$force = undef;
is($force_destroys, 0, "The force is alive");
$aglo->clear_forces;
is($force_destroys, 1, "The force is dead");
$force_destroys = 0;
my $force1 = Graph::Layout::Aesthetic::Force::NodeRepulsion->new;
$aglo->_add_force($force1);
$force1 = undef;
my $force2 = Graph::Layout::Aesthetic::Force::MinEdgeLength->new;
$aglo->_add_force($force2, 2);
$force2 = undef;
is($force_destroys, 0, "The force is alive");
my @forces = $aglo->forces;
is(@forces, 2, "Two forces");
isa_ok($forces[0][0], "Graph::Layout::Aesthetic::Force::MinEdgeLength",
"Right force type");
is(@{$forces[0]}, 2, "Two element force members");
t/02_Aesthetic.t view on Meta::CPAN
isa_ok($forces[1][0], "Graph::Layout::Aesthetic::Force::NodeRepulsion",
"Right force type");
is($forces[1][1], 1, "Right default weight");
KillRef->test($forces[0]);
@forces = ();
is($force_destroys, 0, "The force is alive");
my $forces = $aglo->forces;
is(@$forces, 2, "Two forces");
isa_ok($forces->[0][0], "Graph::Layout::Aesthetic::Force::MinEdgeLength",
"Right force type");
t/02_Aesthetic.t view on Meta::CPAN
"Right force type");
is($forces->[1][1], 1, "Right default weight");
KillRef->test($forces->[0]);
KillRef->test($forces);
is($force_destroys, 0, "The force is alive");
$aglo = undef;
is($force_destroys, 2, "The force is dead");
# Check cleanup on the list form of forces
$aglo = Graph::Layout::Aesthetic->new($topo3, 3);
t/02_Aesthetic.t view on Meta::CPAN
$aglo->_add_force($force1);
$force1 = undef;
$force2 = Graph::Layout::Aesthetic::Force::MinEdgeLength->new;
$aglo->_add_force($force2, 2);
$force2 = undef;
is($force_destroys, 0, "The force is alive");
@forces = $aglo->forces;
$destroys = 0;
$aglo = undef;
is($destroys, 1, "Cleanup on last reference");
is($force_destroys, 0, "The force is alive");
@forces = 0;
is($force_destroys, 2, "The force is alive");
# Check cleanup on the scalar form of forces
$aglo = Graph::Layout::Aesthetic->new($topo3, 3);
$force_destroys = 0;
$force1 = Graph::Layout::Aesthetic::Force::NodeRepulsion->new;
$aglo->_add_force($force1);
$force1 = undef;
$force2 = Graph::Layout::Aesthetic::Force::MinEdgeLength->new;
$aglo->_add_force($force2, 2);
$force2 = undef;
is($force_destroys, 0, "The force is alive");
$forces = $aglo->forces;
$destroys = 0;
$aglo = undef;
is($destroys, 1, "Cleanup on last reference");
is($force_destroys, 0, "The force is alive");
$forces = undef;
is($force_destroys, 2, "The force is alive");
$force_destroys = 0;
$aglo = Graph::Layout::Aesthetic->new($topo3, 3);
eval { $aglo->_add_force(undef) };
like($@, qr!force is undefined at !i, "Proper error message");
t/02_Aesthetic.t view on Meta::CPAN
"Right force type");
is($forces[1][1], 1, "Right default weight");
$destroys = 0;
$aglo = undef;
is($destroys, 1, "Cleanup on last reference");
is($force_destroys, 0, "Manager keeps forces alive");
# Getting and setting coordinates
$aglo = Graph::Layout::Aesthetic->new($topo3);
eval { $aglo->coordinates };
like($@, qr!Usage: Graph::Layout::Aesthetic::coordinates\(state, vertex, \.\.\.\) at !,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Graph/Maker/FibonacciTree.pm view on Meta::CPAN
tree(H-2) node tree(H-2)
/ \ | / \
... ... ... ... ...
This is the genealogy of Fibonacci's rabbit pairs. The root node 1 is a
pair of adult rabbits. They remain alive as node 2 and they have a pair of
baby rabbits as node 3. Those babies do not breed immediately but only in
the generation after at node 6. Every right tree branch is a baby rabbit
pair which does not begin breeding until the month after.
The tree branching follows the Fibonacci word. The Fibonacci word begins as
view all matches for this distribution
view release on metacpan or search on metacpan
lib/GraphQL/Houtou/Runtime/NativeRuntime.pm view on Meta::CPAN
if !GraphQL::Houtou::XS::VM::runtime_value_is_async_xs(
$self->_native_runtime_handle, $result,
);
my ($settled, $value) = (0, undef);
# Keep the derived chain alive until settlement; Future-style adapters may
# otherwise discard it before its callbacks run.
my $chain;
eval {
$chain = GraphQL::Houtou::XS::VM::runtime_then_async_xs(
$self->_native_runtime_handle,
view all matches for this distribution
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
CONFIGURE_REQUIRES => {
'ExtUtils::MakeMaker' => '7.10',
},
TEST_REQUIRES => {
'Test::More' => '0.98',
'Mojolicious::Plugin::GraphQL' => '0.16', # keepalive
'Test::Snapshot' => '0.02', # better snapshot filenames
},
PREREQ_PM => {
'GraphQL' => '0.40', # subscriptions
},
view all matches for this distribution
view release on metacpan or search on metacpan
bin/find-unused-graphite-metrics.pl view on Meta::CPAN
my $gren = Graphite::Enumerator->new(
host => 'https://graphite.example.com',
basepath => $basepath,
lwp_options => {
env_proxy => 0,
keep_alive => 1,
},
);
$gren->enumerate( sub {
my ($path) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
script/grimlock_web_server.pl view on Meta::CPAN
-f --fork MAKE NEW PROCESS FOR REQUEST
(DEFAULT NO TRUE)
-? --help SHOW HELP PAGE FOR DUMMY WHO NO CAN REMEMBER HOW GRIMLOCK WORK
-h --host NAME OF COMPUTER TO RUN GRIMLOCK BEAUTIFUL BLOG SOFTWARE
-p --port NUMBER OF THINGY TO MAKE CONNECTION TO GRIMLOCK BLOG
-k --keepalive SPARE CONNECTION PUNY LIFE
-r --restart RESTART WHEN GET FRUSTRATED AND SMASH FILES
(DEFAULT NO TRUE)
-rd --restart_delay SLOW RESTART BLOG WHEN SMASH FILES
-rr --restart_regex RESTART WHEN THINGIES THAT MATCH ARE SMASHED
view all matches for this distribution