1DBD::Gofer::Transport::UBsaesre(C3o)ntributed Perl DocumDeBnDt:a:tGioofner::Transport::Base(3)
2
3
4
6 DBD::Gofer::Transport::Base - base class for DBD::Gofer client
7 transports
8
10 my $remote_dsn = "..."
11 DBI->connect("dbi:Gofer:transport=...;url=...;timeout=...;retry_limit=...;dsn=$remote_dsn",...)
12
13 or, enable by setting the DBI_AUTOPROXY environment variable:
14
15 export DBI_AUTOPROXY='dbi:Gofer:transport=...;url=...'
16
17 which will force all DBI connections to be made via that Gofer server.
18
20 This is the base class for all DBD::Gofer client transports.
21
23 Gofer transport attributes can be specified either in the attributes
24 parameter of the connect() method call, or in the DSN string. When used
25 in the DSN string, attribute names don't have the "go_" prefix.
26
27 go_dsn
28 The full DBI DSN that the Gofer server should connect to on your
29 behalf.
30
31 When used in the DSN it must be the last element in the DSN string.
32
33 go_timeout
34 A time limit for sending a request and receiving a response. Some
35 drivers may implement sending and receiving as separate steps, in which
36 case (currently) the timeout applies to each separately.
37
38 If a request needs to be resent then the timeout is restarted for each
39 sending of a request and receiving of a response.
40
41 go_retry_limit
42 The maximum number of times an request may be retried. The default is
43 2.
44
45 go_retry_hook
46 This subroutine reference is called, if defined, for each response
47 received where $response->err is true.
48
49 The subroutine is pass three parameters: the request object, the
50 response object, and the transport object.
51
52 If it returns an undefined value then the default retry behaviour is
53 used. See "RETRY ON ERROR" below.
54
55 If it returns a defined but false value then the request is not resent.
56
57 If it returns true value then the request is resent, so long as the
58 number of retries does not exceed "go_retry_limit".
59
61 The default retry on error behaviour is:
62
63 - Retry if the error was due to DBI_GOFER_RANDOM. See L<DBI::Gofer::Execute>.
64
65 - Retry if $request->is_idempotent returns true. See L<DBI::Gofer::Request>.
66
67 A retry won't be allowed if the number of previous retries has reached
68 "go_retry_limit".
69
71 Tracing of gofer requests and responses can be enabled by setting the
72 "DBD_GOFER_TRACE" environment variable. A value of 1 gives a reasonably
73 compact summary of each request and response. A value of 2 or more
74 gives a detailed, and voluminous, dump.
75
76 The trace is written using DBI->trace_msg() and so is written to the
77 default DBI trace output, which is usually STDERR.
78
80 This section is currently far from complete.
81
82 response_retry_preference
83 $retry = $transport->response_retry_preference($request, $response);
84
85 The response_retry_preference is called by DBD::Gofer when considering
86 if a request should be retried after an error.
87
88 Returns true (would like to retry), false (must not retry), undef (no
89 preference).
90
91 If a true value is returned in the form of a CODE ref then, if
92 DBD::Gofer does decide to retry the request, it calls the code ref
93 passing $retry_count, $retry_limit. Can be used for logging and/or to
94 implement exponential backoff behaviour. Currently the called code
95 must return using "return;" to allow for future extensions.
96
98 Tim Bunce, <http://www.tim.bunce.name>
99
101 Copyright (c) 2007-2008, Tim Bunce, Ireland. All rights reserved.
102
103 This module is free software; you can redistribute it and/or modify it
104 under the same terms as Perl itself. See perlartistic.
105
107 DBD::Gofer, DBI::Gofer::Request, DBI::Gofer::Response,
108 DBI::Gofer::Execute.
109
110 and some example transports:
111
112 DBD::Gofer::Transport::stream
113
114 DBD::Gofer::Transport::http
115
116 DBI::Gofer::Transport::mod_perl
117
118
119
120perl v5.32.0 2020-07-28 DBD::Gofer::Transport::Base(3)