.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "DBI::Gofer::Execute 3pm" .TH DBI::Gofer::Execute 3pm "2020-11-08" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" DBI::Gofer::Execute \- Executes Gofer requests and returns Gofer responses .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& $executor = DBI::Gofer::Execute\->new( { ...config... }); \& \& $response = $executor\->execute_request( $request ); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Accepts a DBI::Gofer::Request object, executes the requested \s-1DBI\s0 method calls, and returns a DBI::Gofer::Response object. .PP Any error, including any internal 'fatal' errors are caught and converted into a DBI::Gofer::Response object. .PP This module is usually invoked by a 'server\-side' Gofer transport module. They usually have names in the "\f(CW\*(C`DBI::Gofer::Transport::*\*(C'\fR" namespace. Examples include: DBI::Gofer::Transport::stream and DBI::Gofer::Transport::mod_perl. .SH "CONFIGURATION" .IX Header "CONFIGURATION" .SS "check_request_sub" .IX Subsection "check_request_sub" If defined, it must be a reference to a subroutine that will 'check' the request. It is passed the request object and the executor as its only arguments. .PP The subroutine can either return the original request object or die with a suitable error message (which will be turned into a Gofer response). .PP It can also construct and return a new request that should be executed instead of the original request. .SS "check_response_sub" .IX Subsection "check_response_sub" If defined, it must be a reference to a subroutine that will 'check' the response. It is passed the response object, the executor, and the request object. The sub may alter the response object and return undef, or return a new response object. .PP This mechanism can be used to, for example, terminate the service if specific database errors are seen. .SS "forced_connect_dsn" .IX Subsection "forced_connect_dsn" If set, this \s-1DSN\s0 is always used instead of the one in the request. .SS "default_connect_dsn" .IX Subsection "default_connect_dsn" If set, this \s-1DSN\s0 is used if \f(CW\*(C`forced_connect_dsn\*(C'\fR is not set and the request does not contain a \s-1DSN\s0 itself. .SS "forced_connect_attributes" .IX Subsection "forced_connect_attributes" A reference to a hash of \fBconnect()\fR attributes. Individual attributes in \&\f(CW\*(C`forced_connect_attributes\*(C'\fR will take precedence over corresponding attributes in the request. .SS "default_connect_attributes" .IX Subsection "default_connect_attributes" A reference to a hash of \fBconnect()\fR attributes. Individual attributes in the request take precedence over corresponding attributes in \f(CW\*(C`default_connect_attributes\*(C'\fR. .SS "max_cached_dbh_per_drh" .IX Subsection "max_cached_dbh_per_drh" If set, the loaded drivers will be checked to ensure they don't have more than this number of cached connections. There is no default value. This limit is not enforced for every request. .SS "max_cached_sth_per_dbh" .IX Subsection "max_cached_sth_per_dbh" If set, all the cached statement handles will be cleared once the number of cached statement handles rises above this limit. The default is 1000. .SS "forced_single_resultset" .IX Subsection "forced_single_resultset" If true, then only the first result set will be fetched and returned in the response. .SS "forced_response_attributes" .IX Subsection "forced_response_attributes" A reference to a data structure that can specify extra attributes to be returned in responses. .PP .Vb 6 \& forced_response_attributes => { \& DriverName => { \& dbh => [ qw(dbh_attrib_name) ], \& sth => [ qw(sth_attrib_name) ], \& }, \& }, .Ve .PP This can be useful in cases where the driver has not implemented the \&\fBprivate_attribute_info()\fR method and DBI::Gofer::Execute's own fallback list of private attributes doesn't include the driver or attributes you need. .SS "track_recent" .IX Subsection "track_recent" If set, specifies the number of recent requests and responses that should be kept by the \fBupdate_stats()\fR method for diagnostics. See DBI::Gofer::Transport::mod_perl. .PP Note that this setting can significantly increase memory use. Use with caution. .SS "forced_gofer_random" .IX Subsection "forced_gofer_random" Enable forced random failures and/or delays for testing. See \*(L"\s-1DBI_GOFER_RANDOM\*(R"\s0 below. .SH "DRIVER-SPECIFIC ISSUES" .IX Header "DRIVER-SPECIFIC ISSUES" Gofer needs to know about any driver-private attributes that should have their values sent back to the client. .PP If the driver doesn't support \fBprivate_attribute_info()\fR method, and very few do, then the module fallsback to using some hard-coded details, if available, for the driver being used. Currently hard-coded details are available for the mysql, Pg, Sybase, and SQLite drivers. .SH "TESTING" .IX Header "TESTING" DBD::Gofer, DBD::Execute and related packages are well tested by executing the \&\s-1DBI\s0 test suite with \s-1DBI_AUTOPROXY\s0 configured to route all \s-1DBI\s0 calls via DBD::Gofer. .PP Because Gofer includes timeout and 'retry on error' mechanisms there is a need for some way to trigger delays and/or errors. This can be done via the \&\f(CW\*(C`forced_gofer_random\*(C'\fR configuration item, or else the \s-1DBI_GOFER_RANDOM\s0 environment variable. .SS "\s-1DBI_GOFER_RANDOM\s0" .IX Subsection "DBI_GOFER_RANDOM" The value of the \f(CW\*(C`forced_gofer_random\*(C'\fR configuration item (or else the \&\s-1DBI_GOFER_RANDOM\s0 environment variable) is treated as a series of tokens separated by commas. .PP The tokens can be one of three types: .IP "fail=R%" 4 .IX Item "fail=R%" Set the current failure rate to R where R is a percentage. The value R can be floating point, e.g., \f(CW\*(C`fail=0.05%\*(C'\fR. Negative values for R have special meaning, see below. .IP "err=N" 4 .IX Item "err=N" Sets the current failure err value to N (instead of the \s-1DBI\s0's default 'standard err value' of 2000000000). This is useful when you want to simulate a specific error. .IP "delayN=R%" 4 .IX Item "delayN=R%" Set the current random delay rate to R where R is a percentage, and set the current delay duration to N seconds. The values of R and N can be floating point, e.g., \f(CW\*(C`delay0.5=0.2%\*(C'\fR. Negative values for R have special meaning, see below. .Sp If R is an odd number (R % 2 == 1) then a message is logged via \fBwarn()\fR which will be returned to, and echoed at, the client. .IP "methodname" 4 .IX Item "methodname" Applies the current fail, err, and delay values to the named method. If neither a fail nor delay have been set yet then a warning is generated. .PP For example: .PP .Vb 3 \& $executor = DBI::Gofer::Execute\->new( { \& forced_gofer_random => "fail=0.01%,do,delay60=1%,execute", \& }); .Ve .PP will cause the \fBdo()\fR method to fail for 0.01% of calls, and the \fBexecute()\fR method to fail 0.01% of calls and be delayed by 60 seconds on 1% of calls. .PP If the percentage value (\f(CW\*(C`R\*(C'\fR) is negative then instead of the failures being triggered randomly (via the \fBrand()\fR function) they are triggered via a sequence number. In other words "\f(CW\*(C`fail=\-20%\*(C'\fR" will mean every fifth call will fail. Each method has a distinct sequence number. .SH "AUTHOR" .IX Header "AUTHOR" Tim Bunce, .SH "LICENCE AND COPYRIGHT" .IX Header "LICENCE AND COPYRIGHT" Copyright (c) 2007, Tim Bunce, Ireland. All rights reserved. .PP This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.