line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Gettext::Schema; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1526
|
use namespace::autoclean; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
56
|
use File::DataClass::Constants qw( FALSE LANG TRUE ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
46
|
|
6
|
1
|
|
|
1
|
|
3
|
use File::DataClass::Functions qw( is_hashref merge_attributes ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
7
|
1
|
|
|
1
|
|
3
|
use File::DataClass::Types qw( Directory Str ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
8
|
1
|
|
|
1
|
|
440
|
use File::Gettext::Constants qw( LOCALE_DIRS ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
9
|
1
|
|
|
1
|
|
364
|
use File::Gettext::ResultSource; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
10
|
1
|
|
|
1
|
|
395
|
use File::Gettext::Storage; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
11
|
1
|
|
|
1
|
|
5
|
use Scalar::Util qw( blessed ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
41
|
|
12
|
1
|
|
|
1
|
|
4
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
2
|
|
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
|
14289
|
my $self = shift; |
41
|
1
|
|
|
|
|
7
|
my $storage = $self->storage; |
42
|
1
|
|
|
|
|
15113
|
my $class = 'File::Gettext::Storage'; |
43
|
1
|
|
|
|
|
3
|
my $attr = { schema => $self, storage => $storage }; |
44
|
|
|
|
|
|
|
|
45
|
1
|
50
|
|
|
|
14
|
blessed $storage ne $class and $self->storage( $class->new( $attr ) ); |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
1515
|
return; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |