NAME

WWW::Docker::Role::HTTP - HTTP transport role for Docker Engine API

VERSION

version 0.100

SYNOPSIS

package MyDockerClient;
use Moo;

has host => (is => 'ro', required => 1);
has api_version => (is => 'ro');

with 'WWW::Docker::Role::HTTP';

# Now use get, post, put, delete_request methods
my $data = $self->get('/containers/json');

DESCRIPTION

This role provides HTTP transport for the Docker Engine API. It implements HTTP/1.1 communication over Unix sockets and TCP sockets without depending on heavy HTTP client libraries like LWP.

Features:

  • Unix socket transport (unix://...)

  • TCP socket transport (tcp://host:port)

  • HTTP/1.1 chunked transfer encoding

  • Automatic JSON encoding/decoding

  • Request/response logging via Log::Any

  • Automatic connection management

Consuming classes must provide host and api_version attributes.

get

my $data = $client->get($path, %opts);

Perform HTTP GET request. Returns decoded JSON or raw response body.

Options: params (hashref of query parameters).

post

my $data = $client->post($path, $body, %opts);

Perform HTTP POST request. $body is automatically JSON-encoded if provided.

Options: params (hashref of query parameters).

put

my $data = $client->put($path, $body, %opts);

Perform HTTP PUT request. $body is automatically JSON-encoded if provided.

Options: params (hashref of query parameters).

delete_request

my $data = $client->delete_request($path, %opts);

Perform HTTP DELETE request.

Options: params (hashref of query parameters).

SEE ALSO

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-www-docker/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2025 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.