---
name: "Web::Machine::Util::BodyEncoding"
section: "3pm"
platform: "linux"
package: "libweb-machine-perl"
version: "0.17-4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Web::Machine::Util::BodyEncoding"
---

# Web::Machine::Util::BodyEncoding(3pm)

Module to handle body encoding

## NAME

Web::Machine::Util::BodyEncoding - Module to handle body encoding

## VERSION

version 0.17

## SYNOPSIS

```
  use Web::Machine::Util::BodyEncoding;
```

## DESCRIPTION

This handles the body encoding.

## FUNCTIONS

- "encode\_body\_if\_set ( $resource, $response, $metadata )"

  If the `$response` has a body, this will call `"encode_body"`.

- "encode\_body ( $resource, $response, $metadata )"

  This will find the right encoding (from the 'Content-Encoding' entry in the `$metadata` HASH ref) and the right charset (from the 'Charset' entry in the `$metadata` HASH ref), then find the right transformers in the `$resource`. After that it will attempt to convert the charset and encode the body of the `$response`. Once completed it will set the `"Content-Length"` header in the response as well.

  **CAVEAT:** Note that currently this subroutine doesn't do anything when the body is returned as a CODE ref. This is a bug to be remedied in the future.

## SUPPORT

bugs may be submitted through \<https://github.com/houseabsolute/webmachine-perl/issues\>.

## AUTHORS

- •

  Stevan Little \<stevan@cpan.org\>

- •

  Dave Rolsky \<autarch@urth.org\>

## COPYRIGHT AND LICENCE

This software is copyright (c) 2016 by Infinity Interactive, Inc.

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