lib/Treex/Block/Util/ChangeDocumentPath.pm

filter: Statementstmt 57.1% 12 / 21 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 2 / 3 Podpod 100% 1 / 1 totaltotal 48.3% 15 / 31 CC 4 SCAR 26.1
CC
4
Cov
44%
process_document
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 13.7
« lib/Treex/Block/Write/Sentences.pm ↑ Summary lib/Treex/Core/Node/P.pm »
1 package Treex::Block::Util::ChangeDocumentPath;
2 {
3 1 $Treex::Block::Util::ChangeDocumentPath::VERSION = '0.08633_1';
4 }
5 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Treex::Core::Common;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 extends 'Treex::Core::Block';
8  
9 1 has [qw(file_stem path)] => (
10 isa => 'Str',
11 is => 'ro',
12 documentation => 'sets the respective attribute',
13 );
14  
15 1 has pathre => (
16 is => 'ro',
17 isa => 'Str',
18 documentation => 'The regular expression to apply on document path, e.g. /foo/bar/',
19 );
20  
21  
22 sub process_document {
23 0 ▶ my ( $self, $document ) = @_;
Subroutine process_document: not called CC=4 SCAR=30.0
Pod documented
24  
25 0 ▶ if (defined $self->pathre) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->pathre) 0 0 0
26 0 my $p = $document->path;
27 0 my $pathre = $self->pathre;
28 0 eval "\$p =~ s$pathre;";
29 0 $document->set_path($p);
30 }
31  
32 0 ▶ $document->set_path($self->path) if defined $self->path;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->path 0 0 0
33 0 ▶ $document->set_file_stem($self->file_stem) if defined $self->file_stem;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->file_stem 0 0 0
34  
35 0 return 1;
36 }
37  
38 1 1;
39  
40 __END__
41  
42 =head1 NAME
43  
44 Treex::Block::Util::ChangeDocumentPath
45  
46 =head1 VERSION
47  
48 version 0.08633_1
49  
50 =head1 DESCRIPTION
51  
52 Modifies the document meta-information on filename. Useful before various
53 Writers.
54  
55 Util::ChangeDocumentPath pathre=/foo/bar/
56  
57 =head1 COPYRIGHT AND LICENSE
58  
59 Copyright © 2011 by Institute of Formal and Applied Linguistics, Charles University in Prague
60  
61 This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
« lib/Treex/Block/Write/Sentences.pm ↑ Summary lib/Treex/Core/Node/P.pm »