The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WebSocket::HeaderValue - WebSocket Client & Server

SYNOPSIS

    use WebSocket::HeaderValue;
    my $hv = WebSocket::HeaderValue->new( 'foo' ) || die( WebSocket::HeaderValue->error, "\n" );
    my $hv = WebSocket::HeaderValue->new( 'foo', bar => 2 ) || die( WebSocket::HeaderValue->error, "\n" );
    print( "SomeHeader: $hv\n" );
    # will produce:
    SomeHeader: foo; bar=2

VERSION

    v0.1.0

DESCRIPTION

This is a class to parse and handle HTTP header values in accordance with rfc2616

The object has stringification capability. For this see "as_string"

CONSTRUCTORS

new

Takes a header value, and optionally an hash or hash reference of parameters and this returns the object.

new_from_header

Takes a header value such as food; bar=2 and this will parse it and return a new WebSocket::HeaderValue object.

new_from_multi

Takes a header value that contains potentially multiple values and this returns an array object (Module::Generic::Array) of WebSocket::HeaderValue objects.

METHODS

as_string

Returns the object as a string suitable to be added in a n HTTP header.

original

Cache value of the object stringified. It could also be set during object instantiation to provide the original header value.

    my $hv = WebSocket::HeaderValue->new( 'foo', original => 'foo; bar=2' ) || 
        die( WebSocket::HeaderValue->error );

params

Set or get an hash object (Module::Generic::Hash) of parameters.

qstring

Provided with a string and this returns a quoted version, if necessary.

reset

Remove the cached version of the stringification, i.e. set the object property original to an empty string.

value

Set or get the main header value. For example, in the case of foo; bar=2, the main value here is foo.

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

perl

COPYRIGHT & LICENSE

Copyright(c) 2021 DEGUEST Pte. Ltd.

You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.