| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# $Id$ |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# file::raw Brik |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
package Metabrik::File::Raw; |
|
7
|
1
|
|
|
1
|
|
654
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
29
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use base qw(Metabrik::File::Write); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
408
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub brik_properties { |
|
13
|
|
|
|
|
|
|
return { |
|
14
|
0
|
|
|
0
|
1
|
|
revision => '$Revision$', |
|
15
|
|
|
|
|
|
|
tags => [ qw(unstable read write) ], |
|
16
|
|
|
|
|
|
|
author => 'GomoR ', |
|
17
|
|
|
|
|
|
|
license => 'http://opensource.org/licenses/BSD-3-Clause', |
|
18
|
|
|
|
|
|
|
attributes => { |
|
19
|
|
|
|
|
|
|
input => [ qw(file) ], |
|
20
|
|
|
|
|
|
|
output => [ qw(file) ], |
|
21
|
|
|
|
|
|
|
encoding => [ qw(utf8|ascii) ], # Inherited |
|
22
|
|
|
|
|
|
|
}, |
|
23
|
|
|
|
|
|
|
attributes_default => { |
|
24
|
|
|
|
|
|
|
encoding => 'ascii', |
|
25
|
|
|
|
|
|
|
}, |
|
26
|
|
|
|
|
|
|
commands => { |
|
27
|
|
|
|
|
|
|
read => [ qw(input) ], |
|
28
|
|
|
|
|
|
|
write => [ qw($data|$data_ref|$data_list output) ], |
|
29
|
|
|
|
|
|
|
}, |
|
30
|
|
|
|
|
|
|
require_modules => { |
|
31
|
|
|
|
|
|
|
'Metabrik::File::Read' => [ ], |
|
32
|
|
|
|
|
|
|
}, |
|
33
|
|
|
|
|
|
|
}; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub read { |
|
37
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
38
|
0
|
|
|
|
|
|
my ($input) = @_; |
|
39
|
|
|
|
|
|
|
|
|
40
|
0
|
|
0
|
|
|
|
$input ||= $self->input; |
|
41
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('read', $input) or return; |
|
42
|
|
|
|
|
|
|
|
|
43
|
0
|
0
|
|
|
|
|
my $fr = Metabrik::File::Read->new_from_brik_init($self) or return; |
|
44
|
0
|
|
|
|
|
|
$fr->input($input); |
|
45
|
0
|
|
|
|
|
|
$fr->encoding('ascii'); |
|
46
|
0
|
|
|
|
|
|
$fr->as_array(0); |
|
47
|
0
|
|
|
|
|
|
$fr->strip_crlf(0); |
|
48
|
|
|
|
|
|
|
|
|
49
|
0
|
0
|
|
|
|
|
$fr->open or return; |
|
50
|
0
|
0
|
|
|
|
|
my $data = $fr->read or return; |
|
51
|
0
|
|
|
|
|
|
$fr->close; |
|
52
|
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
return $data; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub write { |
|
57
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
58
|
0
|
|
|
|
|
|
my ($data, $output) = @_; |
|
59
|
|
|
|
|
|
|
|
|
60
|
0
|
|
0
|
|
|
|
$output ||= $self->output; |
|
61
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('write', $data) or return; |
|
62
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('write', $output) or return; |
|
63
|
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
$self->log->debug("write: data[$data]"); |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
0
|
|
|
|
|
$self->open($output) or return; |
|
67
|
0
|
0
|
|
|
|
|
$self->SUPER::write($data) or return; |
|
68
|
0
|
|
|
|
|
|
$self->close; |
|
69
|
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
return 1; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
__END__ |