blib/lib/Erlang/Parser/Node/ReceiveAfter.pm

filter: Statementstmt 100% 22 / 22 Branchbran 100% 2 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 2 / 2 Podpod 100% 1 / 1 totaltotal 93.3% 28 / 30 CC 4 SCAR 12.2
CC
4
Cov
96%
print
4.0
BEGIN
1.0
CRAP 3.4
« blib/lib/Erlang/Parser/Node/If.pm ↑ Summary blib/lib/Erlang/Parser/Node/Atom.pm »
1 # Copyright 2011-2012 Yuki Izumi. ( anneli AT cpan DOT org )
2 # This is free software; you can redistribute it and/or modify it under the
3 # same terms as Perl itself.
4  
5 package Erlang::Parser::Node::ReceiveAfter;
6  
7 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 with 'Erlang::Parser::Node';
9  
10 4 has 'time' => (is => 'rw', required => 1, isa => 'Erlang::Parser::Node');
11 4 has 'stmts' => (is => 'rw', required => 0, isa => 'ArrayRef[Erlang::Parser::Node]');
12  
13 sub print {
14 6 ▶ my ($self, $fh, $depth) = @_;
Subroutine print: called CC=4 SCAR=13.9
Pod documented
15 6 ▶ $depth ||= 0;
Condition50%1/2
$depth ||= 0
l!l
60
MC/DC0%0/1
$depth ||= 0
$depth
Truth table50%1/2
A
A= $depth
Aresult
11
00
16  
17 6 print $fh 'after ';
18 6 $self->time->print($fh, $depth);
19  
20 6 $depth++;
21 6 print $fh " ->\n", "\t" x $depth;
22  
23 6 my $first = 1;
24 6 foreach (@{$self->stmts}) {
25 10 ▶ if ($first) { $first = 0 } else { print $fh ",\n", "\t" x $depth }
Branch: 1 branch
BranchTrueFalseTotal
if ($first) { } 6 4 10
26 10 $_->print($fh, $depth);
27 }
28  
29 6 $depth--;
30 }
31  
32 4 __PACKAGE__->meta->make_immutable;
33  
34 =head1 NAME
35  
36 Erlang::Parser::Node::ReceiveAfter - the after clause for a receive statement
37  
38 =head1 DESCRIPTION
39  
40 Specifies the length of time after which the clause should activate, and the
41 statement block to execute in that case.
42  
43 =head2 Accessors
44  
45 =over 4
46  
47 =item C<time>
48  
49 A L<Erlang::Parser::Node> that yields the number of milliseconds, or the atom
50 infinity.
51  
52 =item C<stmts>
53  
54 A list of L<Erlang::Parser::Node>s to run if the timeout is activated.
55  
56 =back
57  
58 =head2 Methods
59  
60 =over 4
61  
62 =item C<print>
63  
64 Pretty-prints the node to its filehandle argument.
65  
66 =back
67  
68 =head1 EXAMPLE
69  
70 after X ->
71 Y
72  
73 =cut
74  
75 4 1;
76  
77 # vim: set sw=4 ts=4:
« blib/lib/Erlang/Parser/Node/If.pm ↑ Summary blib/lib/Erlang/Parser/Node/Atom.pm »