Treex/Core/TredView/BackendStorable.pm

filter: Statementstmt 58.3% 21 / 36 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 6 / 10 Podpod n/a totaltotal 56.2% 27 / 48 CC 2 SCAR 7.8
CC
2
Cov
55%
open_backend
6.0
test
2.0
read
2.0
CRAP 2.2
« Treex/Core/TredView/Common.pm ↑ Summary Treex/Core/WildAttr.pm »
1 package Treex::Core::TredView::BackendStorable;
2 1 $Treex::Core::TredView::BackendStorable::VERSION = '2.20210102';
3 package Treex::PML::Backend::Treex::Core::TredView::BackendStorable;
4 1 $Treex::PML::Backend::Treex::Core::TredView::BackendStorable::VERSION = '2.20210102';
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Treex::Core::Log;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Treex::Core;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Treex::PML::IO qw( close_backend);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use UNIVERSAL::DOES;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 0 ▶sub test {
Subroutine test: not called CC=1 SCAR=6.9
15 0 my ( $filename, $encoding )=@_;
16 0 return $filename =~ /\.streex$/;
17 }
18  
19 0 ▶sub open_backend {
Subroutine open_backend: not called CC=2 SCAR=17.9
20 0 my ( $filename ) = @_;
21 0 ▶ open my $FILEHANDLE, "<:gzip", $filename or log_fatal($!); # only for reading so far
Branch: 1 branch
BranchTrueFalseTotal
open my $FILEHANDLE, "<:gzip", $filename or log_fatal($!) 0 0 0
22 0 return $FILEHANDLE;
23 }
24  
25 0 ▶sub read { ## no critic (ProhibitBuiltinHomonyms)
Subroutine read: not called CC=1 SCAR=6.9
26  
27 0 my ($filehandle,$pmldoc)=@_;
28 0 my $doc = Treex::Core::Document->retrieve_storable($filehandle);
29 0 my $restore = $doc->_pmldoc;
30  
31 # moving the data from the retrieved document to the prepared empty document
32 0 @{$pmldoc} = @{$restore};
33  
34 # this is a hack for passing the already created Treex::Core structure up to TredView modules;
35 # God knows what the 13th slot is, probably it's a slot for some application data
36 0 $pmldoc->[13]->{_treex_core_document} = $doc;
37 0 return;
38 }
39  
40  
41 0 ▶sub write { ## no critic (ProhibitBuiltinHomonyms)
Subroutine write: not called CC=1 SCAR=6.9
42 0 my ($fd,$fs)=@_;
43 0 log_fatal "Saving of .streex files in TrEd not implemented yet";
44 }
45  
46  
47 1 1;
48 __END__
« Treex/Core/TredView/Common.pm ↑ Summary Treex/Core/WildAttr.pm »