GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Badger::Codec::Encoding(3) User Contributed Perl Documentation Badger::Codec::Encoding(3)

Badger::Codec::Encoding - base class codec for different encodings

    package My::Encoding::utf8;
    use base 'Badger::Codec::Encoding';
    use constant encoding => 'utf8';

    package main;
    my $codec = My::Encoding::utf8->new;
    my $encoded = $codec->encode("...some utf8 data...");
    my $decoded = $codec->decode($encoded);

This module is a subclass of Badger::Codec which itself acts as a base class for various specific encoding modules.

This constant method returns the encoding for the codec. Subclasses are expected to redefine this method to return a string representing their specific encoding.

Method for encoding data. It uses the encoding() method to determine the encoding type and then calls the Encode encode() subroutine to do all the hard work.

    $encoded = $codec->encode($uncoded);

Method for decoding data. It uses the encoding() method to determine the encoding type and then calls the Encode decode() subroutine to do all the hard work.

    $decoded = $codec->decode($encoded);

This method returns a subroutine reference which can be called to encode data.

    my $encoder = $codec->encode;
    $encoded = $encoder->($data);

This method returns a suboroutine reference which can be called to decode data.

    my $decoder = $codec->decode;
    $decoded = $decoder->($data);

Andy Wardley <http://wardley.org/>

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

Encode, Badger::Codec::Encode, Badger::Codec::Unicode, Badger::Codecs, Badger::Codec,
2016-12-12 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.