File: xgettext-lines.pl

package info (click to toggle)
liblocale-xgettext-perl 0.7-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 568 kB
  • sloc: perl: 2,143; ansic: 305; java: 129; makefile: 76; ruby: 73; python: 70
file content (47 lines) | stat: -rwxr-xr-x 960 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#! /usr/bin/env perl

use strict;

use File::Spec;
my $code;

BEGIN {
    my @spec = File::Spec->splitpath(__FILE__);
    $spec[2] = 'PythonXGettext.py';
    my $filename = File::Spec->catpath(@spec);
    open HANDLE, "<$filename"
        or die "Cannot open '$filename': $!\n";
    $code = join '', <HANDLE>;
}

use Inline Python => $code;

foreach my $key (keys %PythonXGettext::) {
    no strict 'refs';
    if ('new' ne $key && defined &{"PythonXGettext::$key"}) {
        *{"Locale::XGettext::Python::$key"} = sub {
            my ($self, @args) = @_;

            $self->{__helper}->$key(@args);
        };
    }
}

Locale::XGettext::Python->newFromArgv(\@ARGV)->run->output;

package Locale::XGettext::Python;

use strict;

use base qw(Locale::XGettext);

sub newFromArgv {
    my ($class, @args) = @_;

    my $self = bless {}, $class;
    $self->{__helper} = PythonXGettext->new($self);
    
    $self->SUPER::newFromArgv(@args);

    return $self;
}