SQL::Tr...::Extra(3)

πŸŽ€ NAME πŸŽ€

okay bestie, meet SQL::Translator::Schema::Role::Extra β€” the page is shortened to SQL::Tr...::Extra(3) up top, but the full module name is the whole thing. It's the role that gives schema classes their "extra" attribute. That's the vibe. πŸ’…

✨ SYNOPSIS ✨

To pull it into a class, you literally do this:

package Foo;
use Moo;
with qw(SQL::Translator::Schema::Role::Extra);

πŸ’– DESCRIPTION πŸ’–

This role provides methods to set and get a hashref of extra attributes for schema objects. No cap, it's the little sidecar of extra data for schema stuff. πŸ¦‹

🧚 METHODS 🧚

πŸ”₯ extra πŸ”₯

Use this to get or set the object's "extra" attributes β€” think "ZEROFILL" for MySQL fields, iykyk. Here's the rundown:

  • Call with no args to get all the extra data.
  • Call with a single name arg to get the value of the named extra attribute, returned as a scalar.
  • Call with a hash or hashref to set extra attributes.

It returns a hash or a hashref. Very demure, very flexible. πŸ’–

Examples, exact:

$field->extra( qualifier => 'ZEROFILL' );

$qualifier = $field->extra('qualifier');

%extra = $field->extra;
$extra = $field->extra;

πŸŽ€ remove_extra πŸŽ€

Plot twist: "extra" can only be used to get or set "extra" attributes β€” it can't remove some. That's why remove_extra exists, bestie. 🫢

  • Call with no args to remove all extra attributes that have been set before.
  • Call with a list of key names to remove certain extra attributes only.

Examples:

# remove all extra attributes
$field->remove_extra();

# remove timezone and locale attributes only
$field->remove_extra(qw/timezone locale/);

mwah πŸ’‹ β€” this page came from User Contributed Perl Documentation, version perl v5.42.0, dated 2024-12-12, and yes the page is SQL::Tr...::Extra(3). Stay iconic. πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from