line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Gettext::Schema; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2034
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
86
|
use File::DataClass::Constants qw( FALSE LANG TRUE ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
62
|
|
6
|
1
|
|
|
1
|
|
5
|
use File::DataClass::Functions qw( is_hashref merge_attributes ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
46
|
|
7
|
1
|
|
|
1
|
|
4
|
use File::DataClass::Types qw( Directory Str ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
11
|
|
8
|
1
|
|
|
1
|
|
716
|
use File::Gettext::Constants qw( LOCALE_DIRS ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
66
|
|
9
|
1
|
|
|
1
|
|
434
|
use File::Gettext::ResultSource; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
10
|
1
|
|
|
1
|
|
491
|
use File::Gettext::Storage; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
11
|
1
|
|
|
1
|
|
6
|
use Scalar::Util qw( blessed ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
58
|
|
12
|
1
|
|
|
1
|
|
4
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
extends q(File::DataClass::Schema); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has 'gettext_catagory' => is => 'ro', isa => Str, default => 'LC_MESSAGES'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has 'language' => is => 'rw', isa => Str, default => LANG; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has 'localedir' => is => 'ro', isa => Directory, coerce => TRUE, |
21
|
|
|
|
|
|
|
default => sub { LOCALE_DIRS->[ 0 ] }; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has '+result_source_class' => default => 'File::Gettext::ResultSource'; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
around 'BUILDARGS' => sub { |
26
|
|
|
|
|
|
|
my ($orig, $self, @args) = @_; my $attr = $orig->( $self, @args ); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# TODO: Deprecated |
29
|
|
|
|
|
|
|
my $lang = delete $attr->{lang}; $attr->{language} //= $lang; |
30
|
|
|
|
|
|
|
my $builder = $attr->{builder} or return $attr; |
31
|
|
|
|
|
|
|
my $config = $builder->can( 'config' ) ? $builder->config : {}; |
32
|
|
|
|
|
|
|
my $keys = [ qw( gettext_catagory language localedir ) ]; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
merge_attributes $attr, $config, $keys; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
return $attr; |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub BUILD { |
40
|
1
|
|
|
1
|
1
|
19147
|
my $self = shift; |
41
|
1
|
|
|
|
|
11
|
my $storage = $self->storage; |
42
|
1
|
|
|
|
|
19612
|
my $class = 'File::Gettext::Storage'; |
43
|
1
|
|
|
|
|
3
|
my $attr = { schema => $self, storage => $storage }; |
44
|
|
|
|
|
|
|
|
45
|
1
|
50
|
|
|
|
22
|
blessed $storage ne $class and $self->storage( $class->new( $attr ) ); |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
1878
|
return; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |