line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::MUST::Core::Roles::Commentable; |
2
|
|
|
|
|
|
|
# ABSTRACT: Commentable Moose role for storable objects |
3
|
|
|
|
|
|
|
$Bio::MUST::Core::Roles::Commentable::VERSION = '0.212530'; |
4
|
17
|
|
|
17
|
|
13485
|
use Moose::Role; |
|
17
|
|
|
|
|
49
|
|
|
17
|
|
|
|
|
233
|
|
5
|
|
|
|
|
|
|
|
6
|
17
|
|
|
17
|
|
98066
|
use autodie; |
|
17
|
|
|
|
|
51
|
|
|
17
|
|
|
|
|
194
|
|
7
|
17
|
|
|
17
|
|
95821
|
use feature qw(say); |
|
17
|
|
|
|
|
46
|
|
|
17
|
|
|
|
|
1845
|
|
8
|
|
|
|
|
|
|
|
9
|
17
|
|
|
17
|
|
139
|
use Bio::MUST::Core::Types; |
|
17
|
|
|
|
|
44
|
|
|
17
|
|
|
|
|
695
|
|
10
|
17
|
|
|
17
|
|
110
|
use Bio::MUST::Core::Constants qw(:files); |
|
17
|
|
|
|
|
43
|
|
|
17
|
|
|
|
|
9196
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has 'comments' => ( |
14
|
|
|
|
|
|
|
traits => ['Array'], |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
isa => 'ArrayRef[Str]', |
17
|
|
|
|
|
|
|
default => sub { [] }, |
18
|
|
|
|
|
|
|
handles => { |
19
|
|
|
|
|
|
|
count_comments => 'count', |
20
|
|
|
|
|
|
|
all_comments => 'elements', |
21
|
|
|
|
|
|
|
join_comments => 'join', |
22
|
|
|
|
|
|
|
add_comment => 'push', |
23
|
|
|
|
|
|
|
get_comment => 'get', |
24
|
|
|
|
|
|
|
insert_comment => 'unshift', |
25
|
|
|
|
|
|
|
}, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub header { |
31
|
58
|
|
|
58
|
1
|
185
|
my $self = shift; |
32
|
|
|
|
|
|
|
|
33
|
58
|
100
|
|
|
|
2515
|
return "#\n" x 2 unless $self->count_comments; |
34
|
35
|
100
|
|
|
|
1253
|
return '# ' . $self->get_comment(0) . "\n#\n" if $self->count_comments == 1; |
35
|
27
|
|
|
|
|
1059
|
return '# ' . $self->join_comments("\n# ") . "\n"; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub is_comment { |
40
|
102205
|
|
|
102205
|
1
|
166279
|
my $self = shift; |
41
|
102205
|
|
|
|
|
134333
|
my $line = shift; |
42
|
102205
|
|
66
|
|
|
241014
|
my $regex = shift // $COMMENT_LINE; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# store comments from file header |
45
|
|
|
|
|
|
|
# TODO: prevent addition of further comments (after first data line) |
46
|
102205
|
|
|
|
|
269697
|
my ($shebang, $comment) = $line =~ $regex; |
47
|
102205
|
100
|
|
|
|
188106
|
if ($shebang) { # strip starting '#' and spaces |
48
|
190
|
100
|
|
|
|
3104
|
$self->add_comment($comment) if $comment; |
49
|
190
|
|
|
|
|
1309
|
return 1; |
50
|
|
|
|
|
|
|
} |
51
|
102015
|
|
|
|
|
277878
|
return 0; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
17
|
|
|
17
|
|
166
|
no Moose::Role; |
|
17
|
|
|
|
|
36
|
|
|
17
|
|
|
|
|
152
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=pod |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 NAME |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Bio::MUST::Core::Roles::Commentable - Commentable Moose role for storable objects |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 VERSION |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
version 0.212530 |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 SYNOPSIS |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# TODO |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 DESCRIPTION |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# TODO |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 METHODS |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 header |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 is_comment |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 AUTHOR |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Denis BAURAIN <denis.baurain@uliege.be> |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
92
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |