.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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 "PGObject::Simple::Role 3pm" .TH PGObject::Simple::Role 3pm "2022-06-16" "perl v5.34.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" PGObject::Simple::Role \- Moo/Moose mappers for minimalist PGObject framework .SH "VERSION" .IX Header "VERSION" Version 2.0.2 .SH "SYNOPSIS" .IX Header "SYNOPSIS" Take the following (Moose) class: .PP .Vb 4 \& package MyAPP::Foo; \& use PGObject::Util::DBMethod; \& use Moose; \& with \*(AqPGObject::Simple::Role\*(Aq; \& \& has id => (is => \*(Aqro\*(Aq, isa => \*(AqInt\*(Aq, required => 0); \& has foo => (is => \*(Aqro\*(Aq, isa => \*(AqStr\*(Aq, required => 0); \& has bar => (is => \*(Aqro\*(Aq, isa => \*(AqStr\*(Aq, required => 0); \& has baz => (is => \*(Aqro\*(Aq, isa => \*(AqInt\*(Aq, required => 0); \& \& sub get_dbh { \& return DBI\->connect(\*(Aqdbi:Pg:dbname=foobar\*(Aq); \& } \& # PGObject::Util::DBMethod exports this \& dbmethod int => (funcname => \*(Aqfoo_to_int\*(Aq); .Ve .PP And a stored procedure: .PP .Vb 6 \& CREATE OR REPLACE FUNCTION foo_to_int \& (in_id int, in_foo text, in_bar text, in_baz int) \& RETURNS INT LANGUAGE SQL AS \& $$ \& select char_length($2) + char_length($3) + $1 * $4; \& $$; .Ve .PP Then the following Perl code would work to invoke it: .PP .Vb 2 \& my $foobar = MyApp\->foo(id => 3, foo => \*(Aqfoo\*(Aq, bar => \*(Aqbaz\*(Aq, baz => 33); \& $foobar\->call_dbmethod(funcname => \*(Aqfoo_to_int\*(Aq); .Ve .PP The following will also work since you have the dbmethod call above: .PP .Vb 1 \& my $int = $foobar\->int; .Ve .PP The full interface of call_dbmethod and call_procedure from PGObject::Simple are supported, and call_dbmethod is effectively wrapped by \fBdbmethod()\fR, allowing a declarative mapping. .SH "DESCRIPTION" .IX Header "DESCRIPTION" .SH "ATTRIBUTES AND LAZY GETTERS" .IX Header "ATTRIBUTES AND LAZY GETTERS" .SS "_get_registry" .IX Subsection "_get_registry" This is a method the consuming classes can override in order to set the registry of the calls for type mapping purposes. .SS "_get_schema" .IX Subsection "_get_schema" Returns the default schema associated with the object. .SS "_get_prefix" .IX Subsection "_get_prefix" Returns string, default is an empty string, used to set a prefix for mapping stored prcedures to an object class. .SH "READ ONLY ACCESSORS (PUBLIC)" .IX Header "READ ONLY ACCESSORS (PUBLIC)" .SS "dbh" .IX Subsection "dbh" Wraps the PGObject::Simple method .SS "funcschema" .IX Subsection "funcschema" Returns the schema bound to the object .SS "funcprefix" .IX Subsection "funcprefix" Prefix for functions .SH "REMOVED METHODS" .IX Header "REMOVED METHODS" These methods were once part of this package but have been removed due to the philosophy of not adding framework dependencies when an application dependency can work just as well. .SS "dbmethod" .IX Subsection "dbmethod" Included in versions 0.50 \- 0.71. .PP Instead of using this directly, use: .PP .Vb 1 \& use PGObject::Util::DBMethod; .Ve .PP instead. Ideally this should be done in your actual class since that will allow you to dispense with the extra parentheses. However, if you need a backwards-compatible and central solution, since PGObject::Simple::Role generally assumes sub-roles will be created for managing db connections etc. you can put the use statement there and it will have the same impact as it did here when it was removed with the benefit of better testing. .SH "AUTHOR" .IX Header "AUTHOR" Chris Travers,, \f(CW\*(C`\*(C'\fR .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests to \f(CW\*(C`bug\-pgobject\-simple\-role at rt.cpan.org\*(C'\fR, or through the web interface at . I will be notified, and then you'll Chris Travers,, \f(CW\*(C`\*(C'\fR .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests to \f(CW\*(C`bug\-pgobject\-simple\-role at rt.cpan.org\*(C'\fR, or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH "SUPPORT" .IX Header "SUPPORT" You can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc PGObject::Simple::Role .Ve .PP You can also look for information at: .IP "\(bu" 4 \&\s-1RT: CPAN\s0's request tracker (report bugs here) .Sp .IP "\(bu" 4 AnnoCPAN: Annotated \s-1CPAN\s0 documentation .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Ratings .Sp .IP "\(bu" 4 Search \s-1CPAN\s0 .Sp .SH "ACKNOWLEDGEMENTS" .IX Header "ACKNOWLEDGEMENTS" .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" Copyright 2013\-2017 Chris Travers,. .PP Redistribution and use in source and compiled forms with or without modification, are permitted provided that the following conditions are met: .IP "\(bu" 4 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer as the first lines of this file unmodified. .IP "\(bu" 4 Redistributions in compiled form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the source code, documentation, and/or other materials provided with the distribution. .PP \&\s-1THIS SOFTWARE IS PROVIDED BY THE AUTHOR\s0(S) \*(L"\s-1AS IS\*(R" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR\s0(S) \s-1BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\s0 (\s-1INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES\s0; \&\s-1LOSS OF USE, DATA, OR PROFITS\s0; \s-1OR BUSINESS INTERRUPTION\s0) \s-1HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\s0 (\s-1INCLUDING NEGLIGENCE OR OTHERWISE\s0) \s-1ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\s0