NAME

HTTP::StructuredField - parse RFC 9651 HTTP Structured Fields

VERSION

version v0.0.1

SYNOPSIS

use HTTP::StructuredField;

try {

    my $dict = HTTP::StructuredField->parse_dictionary( $msg->header("signature-input") );
    for my $key ( $dist->keys ) {

        my $input = $dict->get($key);
        $input->is_inner_list or die "list expected";

        my @items = $input->value->@*;

  }


}
catch ($error) {
  ...
}

DESCRIPTION

This is an object-oriented wrapper around HTTP::libsfparse, for correctly parsing RFC 9651 HTTP Structured Fields.

NAME

HTTP::StructuredField - parse RFC 9651 HTTP Structured Fields

METHODS

parse_item

This parses a string as an HTTP::StructuredField item.

parse_dictionary

This parses a string as a dictionary. The result is Hash::Ordered object where the values are HTTP::StructuredField items.

parse_list

This parses a string as a list. The result is a list reference where the elements are HTTP::StructuredField items.

value

This returns the value of the item.

params

This returns a Hash::Ordered object of the item's parameters. The values are HTTP::StructuredField items.

has_params

This returns true if the item has "params".

type_name

The returns the name of the type as a short string.

type

This returns the numeric type id, which will correspond to one of the constants from HTTP::libsfparse.

Generally you'll want to check the "type_name" or use a predicate such as "is_boolean".

is_boolean

Returns true if the value is a boolean.

is_byteseq

Returns true if the value is a byte sequence.

is_decimal

Returns true if the value is a decimal number.

is_dispstring

Returns true if the value is a Unicode string, a.k.a. a display string.

Note that the value will be surrounded by double quotes, unless it is an element of an inner list or parameter value.

is_integer

Returns true if the value is an integer.

is_inner_list

Returns true if the value is an inner list. The value will be an array reference to a list of unblessed items.

is_string

Returns true if the value is a 7-bit ASCII string.

Note that the value will be surrounded by double quotes, unless it is an element of an inner list or parameter value.

is_token

Returns true if the value is a token.

Tokens are short textual words that begin with an alphabetic character or "*", followed by zero to many token characters, which are the same as those allowed by the HTTP "token" plus the ":" and "/" characters.

SOURCE

The development version is on github at https://github.com/robrwo/perl-HTTP-StructuredField and may be cloned from https://github.com/robrwo/perl-HTTP-StructuredField.git

SUPPORT

Please report any bugs or feature requests on the bugtracker website https://github.com/robrwo/perl-HTTP-StructuredField/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

Robert Rothenberg <perl@rhizomnic.com>

CONTRIBUTOR

Paul Johnson <paul@pjcj.net>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2026 by Robert Rothenberg.

This is free software, licensed under:

The MIT (X11) License