Web::M...coding(3pm)

πŸ’– Web::Machine::Util::BodyEncoding πŸ’–

okay so bestie, this is a page from the User Contributed Perl Documentation β€” it's the manual for Web::Machine::Util::BodyEncoding, a lil module in the Web::Machine::Util family that handles body encoding. yes that's the whole personality. it encodes bodies. let's get into it 🫢


✨ VERSION ✨

version 0.17 β€” that's the one, that's the era we're living in πŸ’…


🌸 SYNOPSIS 🌸

the entire vibe check, in one line:

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

that's it. that's the whole thing. iconic, lowkey. no cap πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

This handles the body encoding. fr fr, that's the description, and honestly? she said what she said. it's the body-encoding department and it's fully staffed πŸ’–


πŸ‘‘ FUNCTIONS πŸ‘‘

encode_body_if_set ( $resource, $response, $metadata )

If the $response has a body, this will call encode_body. that's the whole job. it's giving bouncer at the club β€” no body, no entry, no encoding 🌈

encode_body ( $resource, $response, $metadata )

okay so THIS one is the main character ✨ here's the pipeline:

  • it finds the right encoding from the 'Content-Encoding' entry in the $metadata HASH ref
  • then it finds the right charset from the 'Charset' entry in the $metadata HASH ref
  • then it finds the right transformers in the $resource
  • after that, it attempts 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

like. the way she does all of that in one subroutine. ate. no crumbs. 😭πŸ”₯

⚠️ 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. so if your body is a code ref, bestie, she is simply not showing up to work today πŸ’€ it's a known bug, it's on the list, we'll get there.

πŸŽ€ SUPPORT πŸŽ€

bugs may be submitted through <https://github.com/houseabsolute/webmachine-perl/issues>. please be nice and include the details, she deserves a good bug report πŸ™ˆπŸ’œ


🌟 AUTHORS 🌟

  • Stevan Little <stevan@cpan.org>
  • Dave Rolsky <autarch@urth.org>

two absolute legends, we love them, periodt πŸ‘‘


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. so go off, remix it, ship it, slay πŸ’…πŸŒˆ


and that's the whole page bestie β€” this was Web::M...coding(3pm) from perl v5.34.0, dated 2022-07-03, brought to you by User Contributed Perl Documentation. mwah, go encode something cute πŸ’–βœ¨

πŸ“¦ where this page comes from