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

$Id: Perl.pm 518 2014-10-09 14:56:14Z steffenw $

$HeadURL: svn+ssh://steffenw@svn.code.sf.net/p/perl-gettext-oo/code/extract/trunk/lib/Locale/TextDomain/OO/Extract/Perl.pm $

VERSION

2.000

DESCRIPTION

This module extracts internationalization data from Perl source code.

Implemented rules:

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

__d('...
__dx('...
__dn('...
__dnx('...
__dp('...
__dpx('...
__dnp('...
__dnpx('...

__c('...
__cx('...
__cn('...
__cnx('...
__cp('...
__cpx('...
__cnp('...
__cnpx('...

__dc('...
__dcx('...
__dcn('...
__dcnx('...
__dcp('...
__dcpx('...
__dcnp('...
__dcnpx('...

loc('...
loc_p('...

maketext('...
maketext_p('...

__begin_d('
__begin_c('
__begin_dc('

__end_d
__end_c
__end_dc

Anything before __ is allowed, e.g. N__ and so on. Whitespace is allowed everywhere. Quote and escape any text like: ' text {placeholder} \\ \' ' or q{ text {placeholder} \\ \} \{ }

SYNOPSIS

use Locale::TextDomain::OO::Extract::Perl;
use Path::Tiny qw(path);

my $extractor = Locale::TextDomain::OO::Extract::Perl->new;
for ( @files ) {
    $extractor->clear;
    $extractor->filename($_);
    $extractor->content_ref( \( path($_)->slurp_utf8 ) );
    $exttactor->category('LC_Messages'); # set defaults or q{} is used
    $extractor->domain('default');       # set defaults or q{} is used
    $extractor->extract;
}
... = $extractor->lexicon_ref;

SUBROUTINES/METHODS

method new

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

method preprocess

This method removes the POD and all after __END__.

method stack_item_mapping

This method maps the matched stuff as lexicon item.

method extract

This method runs the extraction.

EXAMPLE

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

DIAGNOSTICS

none

CONFIGURATION AND ENVIRONMENT

none

DEPENDENCIES

Carp

Moo

MooX::Types::MooseLike::Base

namespace::autoclean

Locale::TextDomain::OO::Extract::Base::RegexBasedExtractor

Locale::TextDomain::OO::Extract::Role::File

INCOMPATIBILITIES

not known

BUGS AND LIMITATIONS

none

SEE ALSO

Locale::TextDoamin::OO

AUTHOR

Steffen Winkler

LICENSE AND COPYRIGHT

Copyright (c) 2009 - 2014, 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.