PGObje...Method(3pm)

πŸ’– PGObject::Util::DBMethod πŸ’–

okay bestie, welcome to the manual page for PGObject::Util::DBMethod β€” part of the User Contributed Perl Documentation, and fr fr it's the little helper that lets you map your stored procedures to objects without wanting to scream. PGObject::Util::DBMethod does declarative stored procedure ↔ object mappings for the PGObject Framework. it's giving "I wrote the boilerplate so you don't have to." ✨


🌸 VERSION 🌸

Version 1.01.000 β€” she's grown, she's stable, she's cute. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

so like. without PGObject::Util::DBobject, you would be out here writing this whole thing by hand like a peasant:

sub mymethod {
    my ($self) = @_;
    return $self->call_dbmethod(funcname => 'foo');
}

😭 the DRAMA. the repetition. the way that you type sub and my ($self) = @_; for the hundredth time.

With this module you'd do this instead, and it's so much shorter it's basically a glow-up:

dbmethod mymethod => (funcname => 'foo');

periodt. one line. ate. πŸ”₯


πŸ‘‘ EXPORT πŸ‘‘

This exports only dbmethod, which it always exports. no opt-in, no asking politely, she just shows up. 🫢


✨ SUBROUTINES/METHODS ✨

πŸ’œ dbmethod

use it like dbmethod (name => (default_arghash)) β€” that's the shape, bestie. name on the left, hashref of defaults on the right, slay.

For example:

package MyObject;
use PGObject::Utils::DBMethod;

dbmethod save => (
                               strict_args => 0,
                                  funcname => 'save_user',
                                funcschema => 'public',
                                      args => { admin => 0 },
);
$MyObject->save(args => {username => 'foo', password => 'bar'});

(no, we are not fixing that indentation, that's just how it is, it's part of the vibe now 😌)

πŸŽ€ Special arguments are:

  • arg_lit β€” It set must point to a hashref. Used to allow mapping of function arguments to arg hash elements. If this is set then funcname, funcschema, etc, cannot be overwritten on the call. 🚫 (yes, it locks them down β€” read that part twice, it's the whole point)
  • strict_args β€” If true, args override args provided by user.
  • returns_objects β€” If true, bless returned hashrefs before returning them. ✨
  • merge_back β€” If true, merges the first record back to the $self at the end before returning, and returns $self. Note this is a copy only one layer deep which is fine for the use case of merging return values from the database into the current object.
⚠️ heads up bestie β€” that merge_back one is a shallow copy, one layer deep, no cap. it's fine for what it's for (merging DB return values into your current object) but don't go expecting deep magic, she's not that kind of girl.

🧚 AUTHOR 🧚

Chris Travers, "<chris.travers at gmail.com>" β€” the icon who made this happen. πŸ‘‘


πŸ› BUGS πŸ›

found a bug or want a feature? Please report any bugs or feature requests to "bug-pgobject-util-dbmethod at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=PGObject-Util-DBMethod>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. 🫢 so like, you're not yelling into the void, the void yells back. that's the deal.


🌈 SUPPORT 🌈

You can find documentation for this module with the perldoc command. classic. iconic.

perldoc PGObject::Util::DBMethod

You can also look for information at:

  • RT: CPAN's request tracker (report bugs here) πŸ’Œ

<http://rt.cpan.org/NoAuth/Bugs.html?Dist=PGObject-Util-DBMethod>

  • AnnoCPAN: Annotated CPAN documentation πŸ“

<http://annocpan.org/dist/PGObject-Util-DBMethod>

  • CPAN Ratings ⭐

<http://cpanratings.perl.org/d/PGObject-Util-DBMethod>

  • Search CPAN πŸ”

<http://search.cpan.org/dist/PGObject-Util-DBMethod/>


🌸 ACKNOWLEDGEMENTS 🌸

(yeah bestie, this section is literally empty in the original too. she's a mystery. we respect that. πŸ•³οΈπŸ’–)


Copyright 2014 Chris Travers.

This program is released under the following license: BSD


and that's the whole page, bestie!! πŸ’–βœ¨ this one's from perl v5.32.1, dated 2021-11-08, and it's still out here being PGObje...Method(3pm) (the ellipsis is just the terminal being shy about long names, not me being lazy πŸ™ˆ). go forth and map your stored procedures. mwah. πŸ’…πŸŽ€πŸ¦‹