Badger::Codec::URL

NAME

Top Close Open

Badger::Codec::URL - URL encode/decode

SYNOPSIS

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

DESCRIPTION

Top Close Open

This module implements a subclass of Badger::Codec for URL encoding and decoding. Note the difference between URI and URL. URI encoding is strict and encodes characters like ;, ? and /. The URL codec is more lax and does not encode these characters.

The URI codec should be used for encoding URL parameters. The URL codec can be used to encode complete URLs.

FUNCTIONS

Top Close Open

encode_url($data)

Top Close Open

This function URL-encodes the $data passed as an argument.

decode_url($data)

Top Close Open

This function URL-decodes the $data passed as an argument.

METHODS

Top Close Open

encode($data)

Top Close Open

This method URL-encodes the data referenced by the first argument. It delegates to the encode_url() function.

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

decode($data)

Top Close Open

This method decodes the encoded data passed as the first argument. It delegates to the decode_url() function.

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

encoder()

Top Close Open

This method returns a reference to the encode_url() function.

decoder()

Top Close Open

This method returns a reference to the decode_url() function.

AUTHOR

Top Close Open

Andy Wardley http://wardley.org/

COPYRIGHT

Top Close Open

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

Fork Me on Github