The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Localizer::Scanner::Perl - Scanner for file which is written by perl

SYNOPSIS

    use Localizer::Dictionary;
    use Localizer::Scanner::Perl;

    my $result  = Localizer::Dictionary->new();
    my $scanner = Localizer::Scanner::Perl->new();
    $scanner->scan_file($result, 'path/to/perl.pl');

METHODS

  • Localizer::Scanner::Perl()

    Constructor. It makes scanner instance.

  • $scanner->scan_file($result, $filename)

    Scan file which is written by perl. $result is the instance of Localizer::Dictionary to store results. $filename is file name of the target to scan.

    For example, if target file is follows;

        print q{_("123")};
        print q{l("foo")};
        print q{loc("bar")};

    Scanner uses _('foobar'), l('foobar') and loc('foobar') as msgid (in this case, 'foobar' will be msgid).

    $result will be like a following;

        {
            '123' => {
                'position' => [ [ 'path/to/perl.pl', 1 ] ]
            },
            'foo' => {
                'position' => [ [ 'path/to/perl.pl', 2 ] ]
            },
            'bar' => {
                'position' => [ [ 'path/to/perl.pl', 3 ] ]
            }
        }
  • $scanner->scan($result, $filename, $data)

    This method is almost the same as scan_file(). This method does not load file contents, it uses $data as file contents instead.

SEE ALSO

Locale::Maketext::Extract::Plugin::Perl

LICENSE

Copyright (C) Tokuhiro Matsuno.

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