UR::Object::Tag(3pm)

πŸ“¦
version 0.470 Β· 2 versions
, in debian bookworm, ubuntu jammy, ubuntu noble

πŸ’– UR::Object::Tag πŸ’–

okay bestie, gather round, because this little module is UR::Object::Tag β€” and it's literally just transitory attribute tags for a UR::Object at a given time. that's the whole vibe. tags that don't stick around forever, they just say how the object is doing right now. periodt. πŸŽ€


✨ SYNOPSIS ✨

here's the serve, fr fr:

if (my @attribs = grep { $_->type eq 'invalid' } $obj->attribs()) {
    print $obj->display_name . " has invalid attributes.  They are:\n";
    for my $atrib (@attribs) {
        print join(",",$attrib->properties) . ":" . $atrib->desc . "\n";
    }
}

and this is what it spits out, no cap:

Project H_NHF00 has invalid attributes, they are:
project_subdirectory : Directory does not exist.
target, status : Target cannot be null for projects with an active status.

see how it's giving actual useful diagnostics? obsessed. πŸ”₯


🌸 DESCRIPTION 🌸

so basically, objects of this class get made by create_attribs() on classes that descend from UR::Object. and when you wanna get them back? you call UR::Object->attribs(). that's it, that's the whole loop. πŸ’…


πŸ¦‹ INHERITANCE πŸ¦‹

this class inherits from UR::ModuleBase. family tree moment, we love a lineage. πŸ‘‘


⭐ OBJECT METHODS ⭐

type

a single-word description of the attribute that categorizes it. here are the common attribute types, bestie, memorise them:

  • invalid β€” set when the object has invalid properties and cannot be saved. yeah, it's giving "do not pass go". 😭
  • changed β€” set when the object is different than its "saved" version.
  • hidden β€” set when the object has properties which should not be shown. πŸ™ˆ
  • editable β€” set when some part of the object is editable in the current context.
  • warning β€” set when a warning about the state of the object is in effect.
  • match β€” set when a search which is in effect matches this object's property(s).
  • comment β€” set when this attribute is just an informational message. lowkey the chill one. πŸ’¬

properties

a list of properties the attribute applies to. it's null when the attribute applies to the whole object, but typically it returns one property name. occasionally it returns more than one property. and very rarely (currently never, so like, don't hold your breath) the property may be in the form of an arrayref like:

[ class_name, id, property_name ]

in which case the property may actually be that of another related object. spooky cross-object lore. 🧚

desc

a string of text giving detail to the attribute. the ~flavour text~, if you will. ✨


πŸŽ€ CLASS METHODS πŸŽ€

  • create β€” makes a new UR::Object::Tag. baby tag is born. 🍼
  • delete β€” throws one away. bye bestie, you will not be missed (affectionate). πŸ’€
  • filter β€” sets/gets a filter to be applied to all attribute lists returned in the application. this gives the application developer final veto power over expressed attributes in the app. in most cases, developers will write view components which use attributes, and will ignore them rather than plug-in at this low level to augment/mangle/suppress.

the filter will be given an object reference and a reference to an array of attributes which are tentatively to be delivered for the object.

it's giving final boss veto energy. use with intention, bestie. πŸ‘‘

🌈 SEE ALSO 🌈


and that's the whole page, babe. this was written up for perl v5.32.1, dated 2022-01-17. slay, stay safe, go tag ur objects responsibly. πŸ’œπŸ«ΆπŸŒΈ

πŸ“¦ where this page comes from