AnyEven...DataForm(3)
π AnyEvent::XMPP::Ext::DataForm π
okay so this is the AnyEven...DataForm(3) page from User Contributed Perl Documentation, aka the lore drop for AnyEvent::XMPP::Ext::DataForm. Bestie, it's giving structured-data royalty and we're here for it. π
β¨ NAME β¨
AnyEvent::XMPP::Ext::DataForm β XEP-0004 DataForm. That's the whole name section, and it ate. π
πΈ SYNOPSIS πΈ
There is literally no synopsis text here, bestie β the source page leaves this section empty and lets the methods do the talking. Mysterious main character energy, honestly. β¨
π¦ DESCRIPTION π¦
This module represents a Data Form as specified in XEP-0004. That's the entire description, no cap. π«Ά
π METHODS π
new (%args)β yep, this isnewwith%args, and the page doesn't spill extra tea about it. Quiet luxury. πappend_field ($field)β appends a field to the form, slay. The$fieldmust have the structure described in "FIELD STRUCTURE" below; no improvising, bestie.from_node ($node)β interprets theAnyEvent::XMPP::Nodeobject in$nodeas a data form XML node and reads out the fields plus all associated information. And yes:$nodemust be the XML node of the<x xmlns='jabber:x:data'>tag. Keep that exact, iykyk. π₯make_answer_form ($request_form)β initializes this form with default answers and other neccessary fields from$request_form, which must be of typeAnyEvent::XMPP::Ext::DataFormor compatible. The result is a form with a copy of all fields that are not of typefixed. The fields will also have the default value copied over. The form type will be set tosubmit. The idea is: this creates a template answer form from$request_form. To strip out the unneccessary fields later you don't need call theclear_empty_fieldsmethod. Periodt. β¨clear_empty_fieldsβ removes all fields that have no values and options. Cleanup era. π§remove_field ($field_or_var)β removes a field either by its unique name or by reference.$field_or_varcan either be the unique name or the actual field hash reference you get fromget_fieldorget_fields. Choose your fighter. πset_form_type ($type)β sets the type of the form, which must be one of:
form, submit, cancel, result
No other values, bestie. The list is the list. π
form_typeβ returns the type of the form, which is one of the options described inset_form_typeabove, orundefif no type was yet set. Very demure, very mindful. πΈget_reported_fieldsβ if this is a search result, this method returns more than one element here. The returned list consists of fields as described in "FIELD STRUCTURE", only that they lack values and options. See also theget_itemsmethod. Yes, that's literally the line. π«Άget_itemsβ if this form is a search result, this method returns the list of items of that search. An item is a array ref of fields (field structure is described in "FIELD STRUCTURE"). This method returns a list of items. Iconic search-result behaviour. πget_fieldsβ returns a list of fields. Each field has the structure as described in "FIELD STRUCTURE". No notes. πget_field ($var)β returns the field with the unique field name$var, orundefif no such field is in this form. Bestie is either there or she isn't. πset_field_value ($var, $value)β sets the value of the field with the unique name$var. If the field supports multiple values, all values will be removed and only$valuewill be added; if$valueis undefined, the field's value will be deleted. Dramatic but correct. πadd_field_value ($var, $value)β adds the$valueto the field with the unique name$var. If the field doesn't support multiple values, this method has the same effect asset_field_value. Same vibe, different method name. β¨to_simxmlβ converts the form to a data strcuture that you can pass asnodeargument to thesimxmlfunction which is documented inAnyEvent::XMPP::Util. Example call might be:
my $node = $form->to_simxml;
simxml ($w, defns => $node->{ns}, node => $node);
NOTE: The returned simxml node has the "dns" field set so that no prefixes are generated for the namespace it is in. Keep that note, bestie β it's important. π«Ά
as_debug_stringβ returns a string that represents the form. Only for debugging purposes.
β οΈ Only for debugging purposes, bestie β do not make it your whole personality. π
π FIELD STRUCTURE π
This is the exact shape a field is serving:
{
label => 'field label',
type => 'field type',
var => '(unique) field name'
required => true or false value,
values => [
'value text',
...
],
options => [
['option label', 'option text'],
...
]
}
For the semantics of all fields please consult XEP 0004. Go read the source, iykyk. π
π SEE ALSO π
XEP 0004 β that's the reference, bestie. Go drink from the firehose. π₯
π AUTHOR π
Robin Redeker, "<elmex at ta-sa.org>", JID: "<elmex at jabber.org>". Author section ate and left no crumbs. π
π COPYRIGHT & LICENSE π
Copyright 2007, 2008 Robin Redeker, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Signed with perl v5.42.2, dated 2026-02-15, and still serving AnyEven...DataForm(3) realness. Bye bestie! π«Άβ¨
π¦ where this page comes from
- alpine 3.24: perl-anyevent-xmpp-doc 0.55-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms