HTML::...ndSplit(3pm)

πŸ“¦
version 2.07000 Β· 5 versions
, in debian bookworm, ubuntu jammy, ubuntu noble

πŸ’– HTML::FormFu::Deflator::CompoundSplit πŸ’–

okay bestie, welcome to the HTML::FormFu::Deflator::CompoundSplit page, straight outta the 3pm perl manual section, no cap. this one is a CompoundSplit deflator and it's lowkey one of the most useful little gizmos in the FormFu universe. let's get into it 🫢


✨ VERSION ✨

version 2.07 β€” yes queen, we're on 2.07, slay.


🌸 SYNOPSIS 🌸

here's the vibe, literally:

---
element:
  - type: Multi
    name: address

    elements:
      - name: number
      - name: street

    deflator:
      - type: CompoundSplit

# set the default

$form->get_field('address')->default( $address );

πŸ¦‹ DESCRIPTION πŸ¦‹

so this deflator is the deflator that lets you set several fields' values at once. iconic behaviour honestly.

it's made for use with a HTML::FormFu::Element::Multi group of fields. you know, the little squad of fields that travel together.

here's the tea: a default value that you pass to the Multi field gets split according to the "split" setting, and then its resulting parts get passed along to its child elements. one value in, many values out. main character energy ✨


πŸ’… METHODS πŸ’…

⭐ split ⭐

Arguments: $regex

Default Value: qr/ +/

this is the regex used to split the default value. it defaults to a regex matching 1 or more space characters. simple, clean, periodt.

πŸŽ€ join πŸŽ€

Arguments: $string

Default Value: ' '

okay so imagine this: splitting the value gives you more parts than there are fields. what happens to the extras? they don't just get yeeted, bestie β€” any extra parts are joined again to form the value for the last field. the value of "join" is what's used to join these values.

it defaults to a single space.

for example, if the Multi element contains fields number and name, and is given the value 10 Downing Street β€” when split this results in 3 parts: 10, "Downing" and "Street". in this case, the 1st part, 10, is assigned to the first field, and the 2nd and 3rd parts are re-joined with a space to give the single value "Downing Street", which is assigned to the 2nd field. look at that teamwork 😭πŸ”₯

🌈 field_order 🌈

Arguments: \@order

if the parts from the split value should be assigned to the fields in a different order, you have to provide an arrayref containing the names, in the order they should be assigned to. so you're basically the director casting the parts into their roles, and honestly? you ate.

---
element:
  - type: Multi
    name: address

    elements:
      - name: street
      - name: number

    deflator:
      - type: CompoundSplit
        field_order:
          - number
          - street

πŸ‘‘ AUTHOR πŸ‘‘

Carl Franks


πŸ’œ LICENSE πŸ’œ

This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.


🧚 AUTHOR 🧚

Carl Franks <cpan@fireartist.com>


This software is copyright (c) 2018 by Carl Franks.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


okay that's the whole page bestie, every last detail preserved, not a single option dropped, we're so back πŸ₯Ή

and that's a wrap on HTML::FormFu::Deflator::CompoundSplit, version 2.07, from the 3pm perl manual, generated with perl v5.28.1 back on 2019-01-12. mwah πŸ’‹ go split some values, you've got this πŸ¦‹βœ¨

πŸ“¦ where this page comes from