Net::RDAP::JCard::Property(3p)

NAME
Net::RDAP::JCard::Property - a module representing a property of a Net::RDAP::JCard object.

SYNOPSIS
    #
    # get a property by calling the properties() method on a Net::RDAP::JCard
    # object
    #
    $prop = [ $jcard->properties('tel') ]->[0];

    say $prop->param('type');
    say $prop->value;

DESCRIPTION
The data in a jCard (RFC 7095 <https://www.rfc-editor.org/rfc/rfc7095.html>) object is stored in a set of properties, which this module represents.

Properties have exactly four elements, specifically:

1. the type, which is a string such as "fn" (full name) or "email" (email address);
2. parameters, which are represented as a hashref;
3. a value type, which is a string such as "text" or "URI";
4. the value, which can be a string or arrayref.

Net::RDAP::JCard::Property provides an ergonomic way to access these elements.

CONSTRUCTOR
    $prop = Net::RDAP::JCard::Property->new($ref);

You probably don't need to instantiate these objects yourself, but if you do, you just need to pass an arrayref containing the type, parameters, value type and value.

NOTE ON CASE SENSITIVITY
In general, most values in vCard objects are case-insensitive, however, the jCard RFC <https://datatracker.ietf.org/doc/html/rfc7095> requires that property and value types be lowercase.

Net::RDAP::JCard::Property will internally preserve the case of property and value types so that JSON serialization via the TO_JSON() method will return the original data structure.

Please see the documentation for each of the methods listed below to see how case is handled for those methods.

METHODS

  PROPERTY TYPE
    $type = $prop->type;

Returns a string containing the property type. See the vCard Properties <https://www.iana.org/assignments/vcard-elements/vcard-elements.xhtml#properties> IANA registry for a list of possible values.

This method will always return the property type in lowercase.

  PROPERTY PARAMETERS
    $params = $prop->params;

Returns a hashref containing the property parameters. See the "vCard Parameters|https://www.iana.org/assignments/vcard-elements/vcard-elements.xhtml#parameters" IANA registry for a list of possible parameter names.

The keys of this hashref will always be in lowercase as per Section 3.4 of RFC 7095 <https://datatracker.ietf.org/doc/html/rfc7095#section-3.4>.

    $param = $prop->param($name);

Returns the value of the $name parameter or "undef". $name will be matched case-insensitively against the keys in the hashref.

  PROPERTY VALUE TYPE
    $value_type = $prop->value_type;

Returns a string containing the property value type. See the vCard Value Data Types <https://www.iana.org/assignments/vcard-elements/vcard-elements.xhtml#value-data-types> IANA registry for a list of possible values.

This method will always return the value type in lowercase.

  URIness
Some properties may be URIs, depending on the property type and value type. The may_be_uri() method will return a true value if the property value may be a URI (either because of the specification of its type, or the value of its value_type().

  PROPERTY VALUE
    $value = $prop->value;

Returns the property value.

COPYRIGHT
Copyright 2018-2023 CentralNic Ltd, 2024-2025 Gavin Brown. For licensing information, please see the "LICENSE" file in the Net::RDAP distribution.