line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Locale::TextDomain::OO::Lexicon::Role::StoreFile; ## no critic (TidyCode)
|
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1053
|
use strict;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
69
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
53
|
|
5
|
2
|
|
|
2
|
|
9
|
use Carp qw(confess);
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
100
|
|
6
|
2
|
|
|
2
|
|
405
|
use English qw(-no_match_vars $OS_ERROR);
|
|
2
|
|
|
|
|
1359
|
|
|
2
|
|
|
|
|
12
|
|
7
|
2
|
|
|
2
|
|
260
|
use Moo::Role;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
8
|
2
|
|
|
2
|
|
616
|
use MooX::Types::MooseLike::Base qw(Str);
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
104
|
|
9
|
2
|
|
|
2
|
|
12
|
use namespace::autoclean;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
9
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '1.017';
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has filename => (
|
14
|
|
|
|
|
|
|
is => 'ro',
|
15
|
|
|
|
|
|
|
isa => Str,
|
16
|
|
|
|
|
|
|
);
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has file_handle => (
|
19
|
|
|
|
|
|
|
is => 'ro',
|
20
|
|
|
|
|
|
|
ducktype => 'print',
|
21
|
|
|
|
|
|
|
);
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub store_content {
|
24
|
26
|
|
|
26
|
1
|
3835
|
my ($self, $content) = @_;
|
25
|
|
|
|
|
|
|
|
26
|
26
|
50
|
|
|
|
90
|
if ( $self->file_handle ) {
|
27
|
0
|
|
|
|
|
0
|
my $quoted_filename = $self->filename;
|
28
|
0
|
|
0
|
|
|
0
|
$quoted_filename &&= qq{"$quoted_filename"};
|
29
|
0
|
0
|
|
|
|
0
|
$self->file_handle->print( $self->file_handle, $content )
|
30
|
|
|
|
|
|
|
or confess qq{Unable to print file$quoted_filename $OS_ERROR};
|
31
|
0
|
|
|
|
|
0
|
return;
|
32
|
|
|
|
|
|
|
}
|
33
|
26
|
50
|
|
|
|
66
|
if ( $self->filename ) {
|
34
|
0
|
|
|
|
|
0
|
my $filename = $self->filename;
|
35
|
0
|
0
|
|
|
|
0
|
open my $file_handle, q{> :raw}, $self->filename
|
36
|
|
|
|
|
|
|
or confess qq{Unable to open file "$filename" $OS_ERROR};
|
37
|
0
|
0
|
|
|
|
0
|
$file_handle->print($content)
|
38
|
|
|
|
|
|
|
or confess qq{Unable to print file "$filename" $OS_ERROR};
|
39
|
0
|
0
|
|
|
|
0
|
$file_handle->close
|
40
|
|
|
|
|
|
|
or confess qq{Unable to close file "$filename" $OS_ERROR};
|
41
|
0
|
|
|
|
|
0
|
return;
|
42
|
|
|
|
|
|
|
}
|
43
|
|
|
|
|
|
|
|
44
|
26
|
|
|
|
|
673
|
return $content;
|
45
|
|
|
|
|
|
|
}
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1;
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__
|