SQL::D...s::Role(3pm)

πŸ“¦
version 1.414 Β· 6 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

SQL::Dialects::Role β€” bestie, it's literally the role of being a SQL::Dialect. that's it. that's the job. πŸ’…


🌸 SYNOPSIS 🌸

okay so picture this, you're building your own dialect and you need the ✨aura✨ of a real one:

package My::SQL::Dialect;

use SQL::Dialects::Role;

sub get_config {
    return <<CONFIG;
[SECTION]
item1
item2

[ANOTHER SECTION]
item1
item2
CONFIG
}

that's the whole vibe. you write one method, the role does the rest. slay. 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

this module hands your class the role of being a SQL::Dialect. like, congrats, you're a dialect now, you're the main character. πŸŽ€

πŸ’œ Requirements πŸ’œ

you must implement this one, no skipping, i'm watching:

  • get_config β€”
my $config = $class->get_config;

it returns info about the dialect in an INI-like format. cute little sections, cute little items, very demure.

⭐ Implements ⭐

and the role goes ahead and implements this for you, for free, no cap:

  • get_config_as_hash β€”
my $config = $class->get_config_as_hash;

it gives you back whatever get_config() said, but as a hash ref. glow up fr fr. ✨

heads up: items get upper-cased, sections get lower-cased. that's just the law.

so the example up in the SYNOPSIS would come back looking like this:

{
    section => {
        ITEM1       => 1,
        ITEM2       => 2,
    },
    another_section => {
        ITEM1       => 1,
        ITEM2       => 2,
    }
}

obsessed tbh. 😭


this module is

copyright (c), 2009 by Michael G. Schwern
copyright (c), 2009-2020 by Jens Rehsack.

all rights reserved. 🫑

the module may be freely distributed under the same terms as Perl itself, using either the "GPL License" or the "Artistic License" as specified in the Perl README file. periodt.

you can reach Jeff at: jzuckerATcpan.org and Jens at: rehsackATcpan.org, or slide into the group chat via dbi-devATperl.org. πŸ’Œ


πŸ”₯ SEE ALSO πŸ”₯

  • "dialect()" in SQL::Parser β€” go read that one too, it's giving essential. 🌈

and that's the whole page, bestie πŸ’– β€” this lil manual page lives in the perl docs, perl v5.30.3, dated 2020-10-23, so yeah it's a 2020 baby but it still ate. πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from