DBD::Go...rt::Base(3)

πŸ’– NAME πŸ’–

DBD::Gofer::Transport::Base β€” bestie, this is the base class for all DBD::Gofer client transports. Think of it as the blueprint that every other Gofer transport inherits from. She's the mother of the house. πŸ‘‘


✨ SYNOPSIS ✨

okay so you can spin this up yourself like:

my $remote_dsn = "..."
DBI->connect("dbi:Gofer:transport=...;url=...;timeout=...;retry_limit=...;dsn=$remote_dsn",...)

or, the lazy girl method (no shame, it's faster πŸ’…) β€” turn it on with the DBI_AUTOPROXY environment variable:

export DBI_AUTOPROXY='dbi:Gofer:transport=...;url=...'

and boom, that will force all DBI connections to be made via that Gofer server. every single one. no cap. 🫢


🌸 DESCRIPTION 🌸

This is the base class for all DBD::Gofer client transports. That's the whole vibe here. She's the parent class, the origin story, the blueprint. 🌈


πŸŽ€ ATTRIBUTES πŸŽ€

Gofer transport attributes can be specified either in the attributes parameter of the connect() method call, or in the DSN string. And here's the lil detail you need to remember: when you use them in the DSN string, the attribute names don't get the go_ prefix. the prefix stays home, basically. πŸ™ˆ

go_dsn

The full DBI DSN that the Gofer server should connect to on your behalf. this is the whole point, bestie.

When you use it in a DSN string it must be the last element in the DSN string. like, last-last. no tagalongs after it. ⭐

go_timeout

A time limit for sending a request and receiving a response. Some drivers may implement sending and receiving as separate steps β€” in which case (currently) the timeout applies to each separately. so lowkey watch out for that. 😭

If a request needs to be resent then the timeout gets restarted for each sending of a request and receiving of a response. fresh clock, every time. ⏰

go_retry_limit

The maximum number of times a request may be retried. The default is 2. ✨

go_retry_hook

This subroutine reference gets called, if defined, for each response received where $response->err is true. like a lil alarm bell that rings on everything that went wrong. 🚨

The subroutine is passed three parameters: the request object, the response object, and the transport object.

Now the return value decides everything, so listen up:

  • If it returns an undefined value then the default retry behaviour is used. See "RETRY ON ERROR" below. πŸ‘‡
  • If it returns a defined but false value then the request is not resent. hard no.
  • If it returns a true value then the request is resent β€” so long as the number of retries does not exceed go_retry_limit. πŸŽ‰

πŸ’€ RETRY ON ERROR πŸ’€

The default retry on error behaviour is:

  • Retry if the error was due to DBI_GOFER_RANDOM. See DBI::Gofer::Execute.
  • Retry if $request->is_idempotent returns true. See DBI::Gofer::Request.

A retry won't be allowed if the number of previous retries has reached go_retry_limit. that's the ceiling, bestie, she does not budge. πŸ›‘


πŸ”₯ TRACING πŸ”₯

Tracing of gofer requests and responses can be enabled by setting the DBD_GOFER_TRACE environment variable. here's the scale:

  • A value of 1 gives a reasonably compact summary of each request and response. cute, digestible, slay.
  • A value of 2 or more gives a detailed, and voluminous, dump. like, brace yourself. 😭

The trace is written using DBI->trace_msg() and so is written to the default DBI trace output, which is usually STDERR.


πŸ‘‘ METHODS πŸ‘‘

This section is currently far from complete. (not me telling on the docs like this πŸ™ˆ but fr fr, it says so.)

response_retry_preference

$retry = $transport->response_retry_preference($request, $response);

The response_retry_preference is called by DBD::Gofer when considering if a request should be retried after an error. she's the one who gets consulted at decision time. πŸ’…

Returns:

  • true β€” would like to retry
  • false β€” must not retry
  • undef β€” no preference

If a true value is returned in the form of a CODE ref then, if DBD::Gofer does decide to retry the request, it calls the code ref passing $retry_count, $retry_limit. Can be used for logging and/or to implement exponential back-off behaviour. Currently the called code must return using return; to allow for future extensions. yes literally just return; β€” iconique but specific. ⭐


πŸ¦‹ AUTHOR πŸ¦‹

Tim Bunce, <http://www.tim.bunce.name>


Copyright (c) 2007-2008, Tim Bunce, Ireland. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.


🌈 SEE ALSO 🌈

DBD::Gofer, DBI::Gofer::Request, DBI::Gofer::Response, DBI::Gofer::Execute.

and some example transports, because bestie you know we love options:

  • DBD::Gofer::Transport::stream
  • DBD::Gofer::Transport::http
  • DBI::Gofer::Transport::mod_perl

and that's the whole page, babe 🫢 this was perl v5.42.3, dated 2026-10-19, filed under the DBD::Go...rt::Base(3) manual in the User Contributed Perl Documentation. go forth and proxy responsibly. πŸ’–βœ¨

πŸ“¦ where this page comes from