NAME

Locale::TextDomain::OO::Extract::Perl - Extracts internationalization data from Perl source code

$Id: Perl.pm 255 2009-12-29 14:01:31Z steffenw $

$HeadURL: https://perl-gettext-oo.svn.sourceforge.net/svnroot/perl-gettext-oo/trunk/lib/Locale/TextDomain/OO/Extract/Perl.pm $

VERSION

0.04

DESCRIPTION

This module extracts internationalization data from Perl source code.

Implemented rules:

__('...
__x('...
__n('...
__nx('...
__p('...
__px('...
__np('...
__npx('...
maketext('...
maketext_p('...

Anything before __ is allowed, e.g. N__ and so on. Whitespace is allowed everywhere.

SYNOPSIS

use Locale::TextDomain::OO::Extract::Perl;

SUBROUTINES/METHODS

method new

All parameters are optional. See Locale::TextDomain::OO::Extract to replace the defaults.

my $extractor = Locale::TextDomain::OO::Extract::Perl->new(
    # where to store the pot file
    pot_dir => './',

    # how to store the pot file
    # - The meaning of undef is ISO-8859-1 but use not Perl unicode.
    # - Set 'ISO-8859-1' to have a ISO-8859-1 pot file and use Perl unicode.
    # - Set 'UTF-8' to have a UTF-8 pot file and use Perl unicode.
    # And so on.
    pot_charset => undef,

    # add some key value pairs to the header
    # more see documentation of DBD::PO
    pot_header => { ... },
);

method extract

The default pot_dir is "./".

Call

$extractor->extract('dir/filename.pl');

to extract "dir/filename.pl" to have a "$pot_dir/dir/filename.pl.pot".

Call

open my $file_handle, '<', 'dir/filename.pl'
    or croak "Can no open file dir/filename.pl\n$OS_ERROR";
$extractor->extract('filename', $file_handle);

to extract "dir/filename.pl" to have a "$pot_dir/filename.pot".

EXAMPLE

Inside of this distribution is a directory named example. Run this *.pl files.

DIAGNOSTICS

see Locale::TextDomain::OO::Extract

CONFIGURATION AND ENVIRONMENT

none

DEPENDENCIES

version

parent

Locale::TextDomain::OO::Extract

INCOMPATIBILITIES

not known

BUGS AND LIMITATIONS

none

SEE ALSO

Locale::TextDoamin::OO

AUTHOR

Steffen Winkler

LICENSE AND COPYRIGHT

Copyright (c) 2009, Steffen Winkler <steffenw at cpan.org>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.