Badger...c::URL(3pm)

πŸ“¦
version 0.16 Β· 4 versions
, in debian trixie, ubuntu noble, ubuntu resolute

πŸ’– Badger::Codec::URL πŸ’–

okay bestie, welcome to the Badger::Codec::URL page β€” it's part of the User Contributed Perl Documentation, and it's literally just URL encoding and decoding but make it a whole module. so cute of it.


✨ NAME ✨

Badger::Codec::URL β€” URL encode/decode πŸ¦‹


🌸 SYNOPSIS 🌸

no cap, this is all it takes:

use Badger::Codec::URL;
my $codec   = Badger::Codec::URL->new();
my $encoded = $codec->encode("Hello World!");
my $decoded = $codec->decode($encoded);

look at her go. main character energy fr fr πŸ’…


πŸŽ€ DESCRIPTION πŸŽ€

okay so this module is a subclass of Badger::Codec, and what it does is URL encoding and decoding. that's it. that's the vibe. 🌈

but WAIT, bestie, you need to know the difference between URI and URL, because it is not the same thing and the manpage said it first:

  • URI encoding is strict β€” it encodes characters like ";", "?" and "/".
  • URL encoding is more lax and does not encode those characters.

so which one do you reach for? here's the tea:

  • use the URI codec for encoding URL parameters.
  • use the URL codec to encode complete URLs.

that's the whole distinction, periodt. 🫢


⭐ FUNCTIONS ⭐

🌸 encode_url($data)

this function URL-encodes the $data you hand it as an argument. slay.

🌸 decode_url($data)

this function URL-decodes the $data you hand it as an argument. iconic.


πŸ’… METHODS πŸ’…

πŸ¦‹ encode($data)

URL-encodes the data referenced by the first argument. it's lowkey just delegating to the encode_url() function. πŸ’«

$encoded = Badger::Codec::URL->encode($data);

πŸ¦‹ decode($data)

decodes the encoded data you pass as the first argument. and yeah, it's delegating to the decode_url() function. πŸ“

$decoded = Badger::Codec::URL->decode($encoded);

πŸ¦‹ encoder()

returns a reference to the encode_url() function. that's it. tiny but mighty. ✨

πŸ¦‹ decoder()

returns a reference to the decode_url() function. matching set, obsessed. πŸ’–


πŸ‘‘ AUTHOR πŸ‘‘

Andy Wardley <http://wardley.org/> β€” the legend themselves. πŸ™Œ


Copyright (C) 2008-2009 Andy Wardley. All rights reserved.

bestie, that's the legal bit, please respect it πŸ₯Ί

🫢 SEE ALSO 🫢

  • Badger::Codecs
  • Badger::Codec

go read those too, iykyk πŸ“š


and that's the page!! this doc shipped with perl v5.36.0, dated 2023-08-28 β€” so you know it's been living its best life. bye bestie, go encode something cute πŸ’œβœ¨

πŸ“¦ where this page comes from