view release on metacpan or search on metacpan
t/02-future.t view on Meta::CPAN
if (defined $payload) {
print {$wh} Storable::freeze($payload);
close $wh if !$opt{leave_open};
}
my $f = DBIO::Forked::Future->new(read_fh => $rh);
return ($f, $wh); # caller keeps $wh alive when leave_open
}
# --- success: is_ready true at EOF, get returns rows, idempotent ------------
{
my ($f) = make_future({ rows => [ ['x'], ['y'] ] });
view all matches for this distribution
view release on metacpan or search on metacpan
docs/adr/0001-resolvers-pass-column-hashrefs-as-nodes.md view on Meta::CPAN
(or a list of them) at the boundary, and downstream resolvers operate on
that hashref.
Where a child resolver genuinely needs the row back â relationship
traversal â it **re-finds the row by primary key** rather than keeping a row
reference alive. `DBIO::GraphQL::Relationship::build_field`'s resolver
detects a hashref parent (`if (ref($row) eq 'HASH')`) and calls
`_pk_find($ctx, $moniker, $row)` (`Relationship.pm`, the `_pk_find` helper),
which reads the source's `primary_columns`, pulls the PK values out of the
hashref, and issues a fresh `$ctx->resultset($moniker)->find(...)`. Only then
does it traverse `$row->$rel_name`.
view all matches for this distribution
view release on metacpan or search on metacpan
t/07-pool-connect-replay-unit.t view on Meta::CPAN
is_deeply $conn->{queries},
[ q{SET time_zone = '+00:00'}, q{SET sql_mode = 'TRADITIONAL'} ],
'both replayed actions executed on the freshly-spawned connection via the seam';
# keep $owner alive to the end (the storage holds _owner_storage weakly)
ok $owner, 'owner kept in scope';
}
done_testing;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIO/MySQL/Storage.pm view on Meta::CPAN
);
Strips C<NO_ZERO_DATE> and C<NO_ZERO_IN_DATE> from the session C<sql_mode>
so C<0000-00-00> can be written under MySQL 8 strict mode. Installed as an
C<on_connect_call> it re-runs on every (re)connect, so the session actually
issuing the writes -- not merely the connection alive at deploy time --
carries the relaxed mode. This is the seam L</deploy_setup> delegates to.
=head2 deployment_statements
Overrides the base implementation to automatically pass C<mysql_version> to
view all matches for this distribution
view release on metacpan or search on metacpan
t/32-async-load-age.t view on Meta::CPAN
my $NEXT = 0;
sub _create_connection {
my @log;
return { id => ++$NEXT, log => \@log, dbh => RecHandle->new(\@log) };
}
sub _shutdown_connection { } # keep the log alive for post-shutdown asserts
}
# --- The real Age async backend, with its pool swapped for the recorder -------
# The composed backend's ISA is (Age async layer, future_io transport); we
# reconstruct exactly that here and swap in the recording pool.
t/32-async-load-age.t view on Meta::CPAN
size => $self->{_pool_size} || 2,
);
}
}
my $schema = DBIO::Test->init_schema; # kept alive: storages weaken their refs
# The owning SYNC storage is the composed Age storage (Age LAYER over the PG
# driver) -- it carries connect_call_load_age via the layer.
my $owner_class = DBIO::Storage::Composed->compose(
'DBIO::PostgreSQL::Storage', ['DBIO::PostgreSQL::Age::Storage'],
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIO/PostgreSQL/Async/Storage.pm view on Meta::CPAN
require EV::Pg;
$self->{_listen_pending} = [];
$self->{_listen_connected} = 0;
my $pg = EV::Pg->new(
conninfo => $self->_conninfo_string,
keep_alive => 1,
on_connect => sub {
$self->{_listen_connected} = 1;
my $q = delete $self->{_listen_pending} || [];
$self->{_listen_pending} = [];
$self->{_listen_pg}->query($_, sub {}) for @$q;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIO/PostgreSQL/EV/Storage.pm view on Meta::CPAN
$self->{_listen_pending} = [];
$self->{_listen_dispatching} = 0;
$self->{_listen_connected} = 0;
my $pg = EV::Pg->new(
conninfo => $self->_conninfo_string,
keep_alive => 1,
on_connect => sub {
$self->{_listen_connected} = 1;
$self->_dispatch_listen_queue;
},
on_error => sub { warn "LISTEN connection error: $_[0]\n" },
lib/DBIO/PostgreSQL/EV/Storage.pm view on Meta::CPAN
#
# The recursion pumps exactly one DDL at a time on the pinned connection:
# libpq never has two in flight on the same handle. Each step waits for
# CommandComplete + ReadyForQuery before dispatching the next. The
# surrounding txn_do_async retain()s the returned Then-Future, which keeps
# the whole chain alive until COMMIT/ROLLBACK fires.
sub _execute_ddl_async {
my ($self, $pg, $ddl) = @_;
my @stmts = grep { !/^\s*--/ } _split_statements($ddl);
view all matches for this distribution
view release on metacpan or search on metacpan
t/52leaks.t view on Meta::CPAN
# only clear one object of a specific behavior - more would indicate trouble
delete $weak_registry->{$addr}
unless $cleared->{hash_merge_singleton}{$weak_registry->{$addr}{weakref}{behavior}}++;
}
elsif ($names =~ /^B::Hooks::EndOfScope::PP::_TieHintHashFieldHash/m) {
# there is one tied lexical which stays alive until GC time
# https://metacpan.org/source/ETHER/B-Hooks-EndOfScope-0.15/lib/B/Hooks/EndOfScope/PP/FieldHash.pm#L24
# simply ignore it here, instead of teaching the leaktracer to examine ties
# the latter is possible yet terrible: https://metacpan.org/source/RIBASUSHI/DBIO-0.082840/t/lib/DBIOTest/Util/LeakTracer.pm#L113-117
delete $weak_registry->{$addr}
unless $cleared->{bheos_pptiehinthashfieldhash}++;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIO/Storage/Async.pm view on Meta::CPAN
# ->then chain. Real Future holds a downstream sequence Future only
# WEAKLY, so unless we keep a strong ref it gets GC'd the moment this
# callback returns -- Future warns "lost a sequence Future",
# COMMIT/ROLLBACK never fires, and the await loop busy-spins forever.
# ->retain gives $chain_f a self-reference until it is ready, keeping
# the whole chain alive. Not every future_class implements ->retain
# (an immediately-resolved shim has no GC window), so guard the call.
if (ref $inner && $inner->can('then')) {
my $chain_f = $inner->then(sub {
my @result = @_;
return $self->_query_async_pinned($conn, 'COMMIT', [])->then(sub {
view all matches for this distribution
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
# CRITICAL ORDER: remove() MUST be called BEFORE stop().
#
# IO::Async::Function::stop() sets an internal {stopping} flag and
# begins tearing down IPC channels. Once that flag is set, remove()
# silently fails - the notifier stays in the loop's internal registry,
# keeping the loop (and its SIGCHLD handler) alive past the point where
# we expect them to be freed. During Perl global destruction the loop's
# XS destructor then accesses already-freed memory -> SEGV.
#
# Calling remove() first detaches the Function and all its child
# notifiers (Streams, Handles, Processes) cleanly, then stop() signals
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
0.02 2026-08-07
- Fix a pool worker dying while idle taking the whole pool down
with it. Worker death was only ever noticed as EOF on the read
side, and an idle worker's fd is not readable, so the first
thing that learned about it was the write of the next request -
which failed the future and left the slot alive with a valid
fd.
- A public C ABI. include/dbil_abi.h declares a versioned function-
pointer table.
- selectall_rowhash: every row as a hashref, in the order the server
returned them - DBI's selectall_arrayref($sql, { Slice => {} }).
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
lib/DBIx/QuickDB/Driver.pm view on Meta::CPAN
# holds both the error log and the watcher's launch log). The server
# process's own stdout/stderr go to the watcher's log_file, not the
# driver's error_log, so a server that died (or never launched)
# before writing error_log leaves error_log showing only inherited
# template history -- the real failure is in the launch log. Also
# report whether the server pid is still alive: "not running" points
# at a launch/early-exit failure, "alive" at a slow or hung startup.
# Recorded status before kill(0), which succeeds on a zombie and so
# mislabelled a crashed server as a slow start.
my $spid = $watcher->server_pid;
my $status = $self->_server_exit_status;
my $alive
= $status ? "not running ($status)"
: ($spid && kill(0, $spid)) ? "alive (pid $spid)"
: "not running";
my $error_log = $self->read_error_log;
my $launch_log = $self->_read_file($watcher->log_file);
$watcher->eliminate();
my $msg = "Timed out waiting for server to start after ${timeout}s; server process is $alive.";
$msg .= "\n=== server launch log ===\n$launch_log" if length $launch_log;
$msg .= "\n=== error log ===\n$error_log" if length $error_log;
confess $msg;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/QuickORM/Connection/Transaction.pm view on Meta::CPAN
croak "A transaction ID is required" unless $self->{+ID};
# Hold the connection weakly. The connection holds its transactions weakly in
# turn, so this back-reference does not create a strong cycle; weakening it
# keeps a transaction from pinning its connection alive and from dragging the
# whole connection into a dump or deep comparison of the txn.
weaken($self->{+CONNECTION}) if $self->{+CONNECTION};
$self->{+RESULT} = undef;
lib/DBIx/QuickORM/Connection/Transaction.pm view on Meta::CPAN
#
# The connection is held weakly (the connection already holds its
# transactions weakly, so this just avoids following the back-ref in a dump
# or deep comparison). By the time commit()/rollback() reach this point we
# are running inside the transaction's own action, so the connection is
# alive and it always has a current transaction (at least this one) --
# neither being missing is a normal case, so croak rather than skip the
# check silently.
my $con = $self->{+CONNECTION}
or croak "Cannot $op a transaction whose connection is gone";
my $current = $con->current_txn
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