The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::RDAP::JCard::Property - an object 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) 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 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 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.

    $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 IANA registry for a list of possible values.

This method will always return the value type in UPPERCASE.

PROPERTY VALUE

    $value = $prop->value;

Returns the property value.

COPYRIGHT

Copyright 2024 Gavin Brown. All rights reserved.

LICENSE

Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the author not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.