UR::Object::Tag(3pm)
π 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 newUR::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
- debian bookworm: libur-perl 0.470+ds-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libur-perl 0.470+ds-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libur-perl 0.470+ds-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms