view release on metacpan or search on metacpan
- Made it so that opt can now take any DBI attribute.
1.000 2001-09-04
- Now produces a better error that config/DSN is not defined.
- When the DBIx::Abstract object is destroyed it usually closes any
associated database handles (if it's the last clone alive), now it
will only do this if it created the handle. This way, if you pass
in a handle it will survive its use by DBIx::Abstract.
0.96 2001-07-07
- Fixed stupid bug that made it not accept DBI handles. I can't
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/Async.pm view on Meta::CPAN
elsif ($operation eq 'txn_rollback') {
$schema->storage->txn_rollback;
return { success => 1 };
}
elsif ($operation eq 'ping') {
my $alive = eval { $schema->storage->dbh->do("SELECT 1") };
return { success => ($alive ? 1 : 0), status => "pong" };
}
else {
die "Unknown operation: $operation";
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/CompressColumns.pm view on Meta::CPAN
L<DBIx::Class>,
L<Compress::Zlib>
=head1 AUTHOR
Jesse Stay (jessestay) <jesse@staynalive.com>
A Product of SocialToo.com
=head1 LICENSE
view all matches for this distribution
view release on metacpan or search on metacpan
Debian_CPANTS.txt view on Meta::CPAN
"libpod-xhtml-perl", "Pod-Xhtml", "1.59", "0", "0"
"libpod2-base-perl", "POD2-Base", "not-uploaded", "0", "0"
"libpoe-api-peek-perl", "POE-API-Peek", "1.3400", "0", "0"
"libpoe-component-client-dns-perl", "POE-Component-Client-DNS", "1.051", "0", "0"
"libpoe-component-client-http-perl", "POE-Component-Client-HTTP", "0.890", "0", "0"
"libpoe-component-client-keepalive-perl", "POE-Component-Client-Keepalive", "0.2600", "0", "0"
"libpoe-component-client-mpd-perl", "POE-Component-Client-MPD", "0.9.6", "0", "0"
"libpoe-component-ikc-perl", "POE-Component-IKC", "0.2200", "0", "0"
"libpoe-component-irc-perl", "POE-Component-IRC", "6.16", "0", "0"
"libpoe-component-jabber-perl", "POE-Component-Jabber", "3.00", "0", "0"
"libpoe-component-jobqueue-perl", "POE-Component-JobQueue", "0.5700", "0", "0"
view all matches for this distribution
view release on metacpan or search on metacpan
t/22.one_to_many_fields.t view on Meta::CPAN
### Create a form with 1 existing objects with one non existing releation
my $formdata = {
# The existing objects
$helper->fieldname($film, 'title', 'o1') => 'Sound of music',
$helper->fieldname($film, 'length', 'o1') => 100,
$helper->fieldname($film, 'comment', 'o1') => 'The hills are alive...',
$helper->fieldname($film, 'location_id','o1') => 'o2',
$helper->fieldname($location, 'name', 'o2') => 'Somewhere over the rainbow',
};
ok(1,"Formdata created:\n".pp($formdata));
view all matches for this distribution
view release on metacpan or search on metacpan
t/10loader.t view on Meta::CPAN
quiet => 0,
test_rels => [
'Bars.quuxref' => 'quuxs.quuxid', # foreign key
],
);
} "the loader managed to stay alive";
lives_and {
$schema2 = make_schema(
loader_class => 1,
no_increment => 1,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/Manual/Cookbook.pod view on Meta::CPAN
An easy way to use transactions is with
L<DBIx::Class::Storage::TxnScopeGuard>. See L</Automatically creating
related objects> for an example.
Note that unlike txn_do, TxnScopeGuard will only make sure the connection is
alive when issuing the C<BEGIN> statement. It will not (and really can not)
retry if the server goes away mid-operations, unlike C<txn_do>.
=head1 SQL
=head2 Creating Schemas From An Existing Database
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Connector/Pool.pm view on Meta::CPAN
my ($class, %args) = @_;
$args{initial} //= 1;
$args{tid_func} //= sub {1};
$args{wait_func} //= sub {croak "real waiting function must be supplied"};
$args{max_size} ||= -1;
$args{keep_alive} //= -1;
$args{user} //= ((getpwuid $>)[0]);
$args{password} //= '';
$args{attrs} //= {};
$args{dsn} //= 'dbi:Pg:dbname=' . $args{user};
$args{connector_mode} //= 'fixup';
lib/DBIx/Connector/Pool.pm view on Meta::CPAN
--$connected_size;
};
my $now = time;
for ($i = @{$self->{pool}} - 1; $i >= 0 && $connected_size > $self->{initial}; --$i) {
if ($self->{pool}[$i]{connector} && !$self->{pool}[$i]{connector}->item_in_use) {
if ($now - $self->{pool}[$i]{connector}->item_last_use > $self->{keep_alive}) {
$remove_sub->();
} else {
$self->{pool}[$i]{tid} = undef;
}
} elsif (!$self->{pool}[$i]{connector}) {
lib/DBIx/Connector/Pool.pm view on Meta::CPAN
use Coro::AnyEvent;
use DBIx::Connector::Pool;
my $pool = DBIx::Connector::Pool->new(
initial => 1,
keep_alive => 1,
max_size => 5,
tid_func => sub {"$Coro::current" =~ /(0x[0-9a-f]+)/i; hex $1},
wait_func => sub {Coro::AnyEvent::sleep 0.05},
attrs => {RootClass => 'DBIx::PgCoroAnyEvent'}
);
lib/DBIx/Connector/Pool.pm view on Meta::CPAN
=item B<new>
my $pool = DBIx::Connector::Pool->new(
initial => 1,
keep_alive => 1,
max_size => 5,
tid_func => sub {"$Coro::current" =~ /(0x[0-9a-f]+)/i; hex $1},
wait_func => sub {Coro::AnyEvent::sleep 0.05},
attrs => {RootClass => 'DBIx::PgCoroAnyEvent'}
);
lib/DBIx/Connector/Pool.pm view on Meta::CPAN
=item B<initial>
Initial number of connected connectors. This means also minimum of of
connected connectors. It throws error if this minimum can not be met.
=item B<keep_alive>
How long connector can live after it becomes unused. Initial connectors will
live forever. C<-1> means no limit. C<0> means collect it immediate. Positive
number means seconds.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/DataStore.pm view on Meta::CPAN
against.
With load on demand in mod_perl, you end up only loading it
for a single Apache process when it's first needed. If more than one
process needs it, more than one copy is loaded. If those processes are
eventually killed (through max keepalive request like settings) and its
needed again, then it has to be loaded all over again. Instead, preloading
it in the main Apache process creates a single copy available to every
child Apache process for the lifetime of that Apache run.
=head1 DATABASE METHODS
view all matches for this distribution
view release on metacpan or search on metacpan
{
$dbh = DBI->connect ( @dbi_csv_args );
$table = DBIx::HTML->connect( $dbh );
isa_ok $table, 'DBIx::HTML', "object created";
isa_ok $table->{dbh}, 'DBI::db', "database handle copied";
isa_ok $dbh, 'DBI::db', "database alive before object expires";
}
isa_ok $dbh, 'DBI::db', "database still alive before object expires";
$dbh = DBI->connect ( @dbi_csv_args );
$table = DBIx::HTML->connect( $dbh );
is output( 'select * from test' ),
'<table><tr><th>Id</th><th>Parent</th><th>Name</th><th>Description</th></tr><tr><td>1</td><td> </td><td>root</td><td>the root</td></tr><tr><td>2</td><td>1</td><td>kid1</td><td>some kid</td></tr><tr><td>3</td><td>1</td><td>kid2</td><td>some o...
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Mint.pm view on Meta::CPAN
This accessor/mutator will return the underlying L<DBIx::Connector> object.
=head2 dbh
This method will return the underlying database handle, which is guaranteed to be alive.
=head2 abstract
This is the accessor/mutator for the L<SQL::Abstract::More> subjacent object.
lib/DBIx/Mint.pm view on Meta::CPAN
Note that it must be called as an intance method, not as a class method.
=head1 USE OF L<DBIx::Connector>
Under the hood, DBIx::Mint uses DBIx::Connector to hold the database handle and to make sure that the connection is well and alive when you need it. The database modification routines employ the 'fixup' mode for modifying the database at a very fine-...
The query routines offered by L<DBIx::Mint::ResultSet> use the 'fixup' mode while retrieving the statement holder with the SELECT query already prepared, but not while extracting information in the execution phase. If you fear that the database conne...
=head1 DEPENDENCIES
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Poggy.pm view on Meta::CPAN
$dbh = shift @{ $self->{free} };
my $used = delete $self->{last_used}{ refaddr $dbh };
if ( (time - $used) > $self->{ping_on_take} ) {
unless ( $dbh->ping ) {
warn "connection is not alive, dropping";
next;
}
}
last;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/QueryLog.pm view on Meta::CPAN
# ... do something
DBIx::QueryLog->disable;
=item ignore_trace
Returns a guard object and disables tracing while the object is alive.
use DBIx::QueryLog;
# enabled
$dbh->do(...);
view all matches for this distribution
view release on metacpan or search on metacpan
t/Drivers/MariaDB.t view on Meta::CPAN
my $db = get_db {driver => 'MariaDB', load_sql => [quickdb => 't/schema/mariadb.sql']};
my $dir = $db->dir;
my $pid = $db->watcher->server_pid;
ok(-d $dir, "Can see the db dir");
ok(kill(0, $pid), "Can signal the db process (it's alive!)");
$db = undef;
my $start = time;
my $pid_gone = 0;
view all matches for this distribution
view release on metacpan or search on metacpan
Roles/AutoReconnect.pm view on Meta::CPAN
unless $@;
# restore context if calls are restarted
$self-> context( $context);
}
if ( $self-> dbh-> ping) {
# DB is alive, most probably that was not a DBI-related error
if ( $conninfo-> [3]-> {RaiseError}) {
die $@;
} else {
warn $@ if
not (exists $conninfo->[3]->{PrintError}) # DBI defaults
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Table/TestDataGenerator.pm view on Meta::CPAN
my $max_tree_depth = $args{max_tree_depth};
my $min_children = $args{min_children};
my $min_roots = $args{min_roots};
my $roots_have_null_parent_id = $args{roots_have_null_parent_id};
my $csv_dir = $args{csv_dir};
my $keep_connection_alive = $args{keep_connection_alive};
my $transaction_size = $args{transaction_size};
my $dumper = DBIxSchemaDumper->new(
dsn => $self->dsn,
user => $self->user,
lib/DBIx/Table/TestDataGenerator.pm view on Meta::CPAN
$transaction_size
&& $num_records_added % $transaction_size != 0
)
|| !$transaction_size
);
Query->disconnect($dbh_out) unless $keep_connection_alive;
};
if ($@) {
warn "Transaction aborted because $@";
eval { $dbh->rollback };
lib/DBIx/Table/TestDataGenerator.pm view on Meta::CPAN
=item * csv_dir
Optional path to a csv file which will contain the test data, no data will be written to the target database in this case. If not defined, changes are applied to the target database.
=item * keep_connection_alive
Optional parameter defining if the database handle dbh should still be connected after having created the test data, defaults to false. (For some install tests, we need to set it to true since we are using an in-memory database which would otherwise ...
=item * transaction_size
lib/DBIx/Table/TestDataGenerator.pm view on Meta::CPAN
=head2 disconnect
Arguments: none
Allows to disconnect the connection to the target database in case keep_connection_alive was set to true before when calling create_testdata.
=head1 INSTALLATION AND CONFIGURATION
To install this module, run the following commands:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/TempDB.pm view on Meta::CPAN
# database is cleaned up when test exit
=head1 DESCRIPTION
L<DBIx::TempDB> is a module which allows you to create a temporary database,
which only lives as long as your process is alive. This can be very
convenient when you want to run tests in parallel, without messing up the
state between tests.
This module currently support PostgreSQL, MySQL and SQLite by installing the optional
L<DBD::Pg>, L<DBD::mysql> and/or L<DBD::SQLite> modules.
view all matches for this distribution
view release on metacpan or search on metacpan
testdata/encantadas.txt view on Meta::CPAN
From a broken, stairlike base, washed as the steps of a water palace by the
waves, the tower rose in entablatures of strata to a shaven summit. These
uniform layers, which compose the mass, form its most peculiar feature. For
at their lines of junction they project flatly into encircling shelves,
from top to bottom, rising one above another in graduated series. And as
the eaves of any old barn or abbey are alive with swallows, so were all
these rocky ledges with unnumbered seafowl. Eaves upon eaves, and nests
upon nests. Here and there were long birdlime streaks of a ghostly white
staining the tower from sea to air, readily accounting for its saillike
look afar. All would have been bewitchingly quiescent were it not for the
demoniac din created by the birds. Not only were the eaves rustling with
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/TextSearch.pm view on Meta::CPAN
$self->say("is file newer than already indexed version?\n");
if ($ftype eq 'http') {
$self->say("checking md5 sum with http\n");
my $ua = LWP::UserAgent->new(env_proxy => 1,
keep_alive => 1,
timeout => 30);
my $response = $ua->get($loc);
cluck "Error while getting ", $response->request->uri,
" -- ", $response->status_line, "\nAborting"
unless $response->is_success;
view all matches for this distribution
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