SQL::Tr...ListAttr(3)

πŸ’– NAME πŸ’–

Hiiii bestie! You’re looking at SQL::Tr...ListAttr(3) β€” yes, that’s the manual name, and this is one of those User Contributed Perl Documentation pages. It’s all about SQL::Translator::Role::ListAttr: context-sensitive list attributes. That’s the whole vibe. Slay. ✨


πŸŽ€ SYNOPSIS πŸŽ€

package Foo;
    use Moo;
    use SQL::Translator::Role::ListAttr;

    with ListAttr foo => ( uniq => 1, append => 1 );

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so this package gives you a variable Moo::Role for list attributes that are context-sensitive. It’s literally right there in the name, bestie. πŸ’…


πŸ› οΈ FUNCTIONS πŸ› οΈ

🌟 ListAttr $name => %parameters;

This returns a Moo::Role providing an arrayref attribute named $name, and it wraps the accessor so it’s context-sensitive both for setting and getting. If no builder or default is provided, the default value is the empty list. Periodt.

On setting, the arguments are parsed using parse_list_arg in SQL::Translator::Utils, and the accessor will return an array reference or a list, depending on context. It’s giving dual-threat accessor energy. πŸ‘‘

Parameters

  • append β€” if true, the setter will append arguments to the existing ones, rather than replacing them. No deleting your old faves. 🫢
  • uniq β€” if true, duplicate items will be removed, keeping the first one seen. First come, first served, iconic behavior. ✨
  • may_throw β€” if accessing the attribute might throw an exception (e.g. from a builder or isa check), this should be set to make the accessor store the exception using SQL::Translator::Role::Error and return undef. Safety first, bestie. πŸ›Ÿ
  • undef_if_empty β€” if true, and the list is empty, the accessor will return undef instead of a reference to an empty in scalar context. Empty-list behavior, handled. πŸ’€

Unknown parameters are passed through to the has call for the attribute. So yeah, they get handed off. Not me explaining has call passthrough with full main-character focus. πŸ™ˆ


🌈 SEE ALSO 🌈

  • SQL::Translator::Utils
  • SQL::Translator::Role::Error

Mwah πŸ’‹ β€” this iconic little page comes from perl v5.42.0, dated 2024-12-12, and its manual-page name is SQL::Tr...ListAttr(3). Byeeee bestie, go slay those context-sensitive list attributes! πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from