DBD-PO

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

- new Test 08_previous.t
- renew examples

1.00  Tue Oct 21 21:20:00 2008
- 1st stable version
- POD
- perl critic

0.10  Fri Sep 26 22:00:00 2008
- tenth developer test version
- code_ref $maketext_to_gettext_scalar at DBD::PO::db is unicode safe now
- more POD for DBD::PO
- change from load_file_asarray to load_entry
- bugfix binmode

0.09  Sat Sep 20 22:00:00 2008
- ninth developer test version
- change header parser to non case sensitive
- change examples and create new example: read using Locale-Maketext

0.08  Thu Sep 18 22:00:00 2008

example/11_read_using_Locale-Maketext.pl  view on Meta::CPAN

                || q{.};
    my $table = $TABLE_2X
                || 'table_de.po'; # for langueage de

    # The lexicon is for langueage xx
    # and has 1 utf-8 po file.
    Locale::Maketext::Lexicon->import({
        de      => [
            Gettext => "$path/$table",
        ],
        _decode => 1, # unicode mode
    });
}

use Carp qw(croak);
use Tie::Sub (); # allow to write a subroutine call as fetch hash

my $language = 'de_DE';
# create a language handle for language xx
my $lh = Example::L10N->get_handle($language)
    or croak 'What language';

example/21_read.pl  view on Meta::CPAN

() = eval 'use Test::DBD::PO::Defaults qw($PATH $TABLE_2X)'; ## no critic (StringyEval InterpolationOfMetachars)

my $path  = $PATH
            || q{.};
my $table = $TABLE_2X
            || 'table_xx.po'; # for langueage xx

my $dbh;
# Read the charset from the po file (table)
# and than change the encoding to this charset.
# This is the way to read unicode chars from unknown po files.
my $po_charset = q{};
for (1 .. 2) {
    $dbh = DBI->connect(
        "DBI:PO:f_dir=$path;po_charset=$po_charset",
        undef,
        undef,
        {
            RaiseError => 1,
            PrintError => 0,
        },

example/22_read_plural.pl  view on Meta::CPAN

() = eval 'use Test::DBD::PO::Defaults qw($PATH_P $TABLE_2P)'; ## no critic (StringyEval InterpolationOfMetachars)

my $path  = $PATH_P
            || q{./LocaleData/de/LC_MESSAGES};
my $table = $TABLE_2P
            || 'table_plural.po';

my $dbh;
# Read the charset from the po file (table)
# and than change the encoding to this charset.
# This is the way to read unicode chars from unknown po files.
my $po_charset = q{};
for (1 .. 2) {
    $dbh = DBI->connect(
        "DBI:PO:f_dir=$path;po_charset=$po_charset",
        undef,
        undef,
        {
            RaiseError => 1,
            PrintError => 0,
        },

lib/DBD/PO.pm  view on Meta::CPAN

        . "po_eol=$LF;"       # optional:
                              #  The default 'po_eol' (po end of line)
                              #  is network typical like 'use Socket qw($CRLF)',
                              #  here set to $LF like 'use Socket qw($LF)'.
                              #  The default value is mostly useful.
        . 'po_charset=utf-8', # optional:
                              #  Write nothing for 'iso-8859-1' files
                              #  and use bytes internal.
                              #  (It is not a good idea.)
                              #  Write 'utf-8' for 'utf-8' files
                              #  and use unicode chars internal.
                              #  Write 'iso-8859-1' for 'iso-8859-1' files
                              #  and use unicode chars internal
                              #  and so on for other charsets.
                              #  The default value is mostly not useful.
        undef,                # Username is not used.
        undef,                # Password is not used.
        {
            RaiseError => 1,  # The easy way to handle exceptions.
            PrintError => 0,  # The easy way to handle exceptions as warnings.
        },
    ) or croak 'Cannot connect: ' . DBI->errstr();



( run in 0.408 second using v1.01-cache-2.11-cpan-f29a10751f0 )