WebSocket::HeaderValue - WebSocket Client & Server
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
v0.1.0
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"
Takes a header value, and optionally an hash or hash reference of parameters and this returns the object.
Takes a header value such as food; bar=2 and this will parse it and return a new WebSocket::HeaderValue object.
food; bar=2
Takes a header value that contains potentially multiple values and this returns an array object (Module::Generic::Array) of WebSocket::HeaderValue objects.
Returns the object as a string suitable to be added in a n HTTP header.
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 );
Set or get an hash object (Module::Generic::Hash) of parameters.
Provided with a string and this returns a quoted version, if necessary.
Remove the cached version of the stringification, i.e. set the object property original to an empty string.
original
Set or get the main header value. For example, in the case of foo; bar=2, the main value here is foo.
foo; bar=2
foo
Jacques Deguest <jack@deguest.jp>
WebSocket::Request, WebSocket::Response
Copyright(c) 2021-2023 DEGUEST Pte. Ltd.
You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.
To install WebSocket, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebSocket
CPAN shell
perl -MCPAN -e shell install WebSocket
For more information on module installation, please visit the detailed CPAN module installation guide.