Badger

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

t/codec/codecs.t
t/codec/data/example.ts
t/codec/encode.t
t/codec/encoding.t
t/codec/html.t
t/codec/json.t
t/codec/lib/My/Codec/Foo.pm
t/codec/storable.t
t/codec/timestamp.t
t/codec/tt.t
t/codec/unicode.t
t/codec/uri.t
t/codec/url.t
t/config/filesystem.t
t/config/filesystem2.t
t/config/test_files/config1/pages.yaml
t/config/test_files/config1/pages/auth.yaml
t/config/test_files/config1/site.yaml
t/config/test_files/config1/things.yaml
t/config/test_files/config1/user.yaml
t/config/test_files/config2/config.yaml

lib/Badger/Codec/Unicode.pm  view on Meta::CPAN

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

You can also call L<encode()> and L<decode()> as class methods.

    my $encoded = Badger::Code::Unicode->encode($uncoded);
    my $decoded = Badger::Code::Unicode->decode($encoded);

You can also use a codec via the L<Badger::Codecs> module.

    use Badger::Codecs 
        codec => 'unicode';

This exports the C<encode()> and C<decode()> subroutines.

    my $uncoded  = "...some Unicode data...";
    my $encoded  = encode($uncoded);
    my $decoded  = decode($encoded)

=head1 METHODS

=head2 encode($encoding, $data)

t/codec/encode.t  view on Meta::CPAN

#========================================================================
#
# t/codec/encode.t
#
# Test the Badger::Codec::Encode module.
#
# Written by Andy Wardley <abw@wardley.org> using code from the TT2 
# t/unicode.t test written by Mark Fowler <mark@twoshortplanks.com>
#
# This is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
#========================================================================

use strict;
use warnings;
use lib qw( ./lib ../lib ../../lib );
use Badger::Codec::Encode;

t/codec/encoding.t  view on Meta::CPAN

#========================================================================
#
# t/codec/encoding.t
#
# Test the Badger::Codec::encoding module.
#
# Written by Andy Wardley <abw@wardley.org> using code from the TT2 
# t/unicode.t test written by Mark Fowler <mark@twoshortplanks.com>
#
# This is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
#========================================================================

use strict;
use warnings;
use lib qw( ./lib ../lib ../../lib );
use Badger::Codec::Encoding;

t/codec/unicode.t  view on Meta::CPAN

#========================================================================
#
# t/codec/unicode.t
#
# Test the Badger::Codec::Unicode module.
#
# Written by Andy Wardley <abw@wardley.org> using code from the TT2 
# t/unicode.t test written by Mark Fowler <mark@twoshortplanks.com>
#
# This is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
#========================================================================

use strict;
use warnings;
use lib qw( ./lib ../lib ../../lib );
use Badger::Codec::Unicode;

t/codec/unicode.t  view on Meta::CPAN

    return $text;
}


#-----------------------------------------------------------------------
# now try it with encode() / decode() subs
#-----------------------------------------------------------------------

package Badger::Test::Encode::Codec;
use Badger::Codecs
    codec => 'unicode';

our $moose   = $main::moose;
our $uncoded = $main::uncoded;
our $encoded = $main::encoded;
*reasciify   = \&main::reasciify;
*nicely      = \&main::nicely;
*ok          = \&main::ok;
*is          = \&main::is;

while (my ($enc, $original) = each %$encoded) {



( run in 0.620 second using v1.01-cache-2.11-cpan-88abd93f124 )