File Coverage

blib/lib/Erlang/Parser/Node/Binary.pm
Criterion Covered Total %
statement 14 14 100.0
branch 2 2 100.0
condition 2 2 100.0
subroutine 2 2 100.0
pod 1 1 100.0
total 21 21 100.0


line stmt bran cond sub pod time code
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::Binary;
6              
7 3     3   10 use Moose;
  3         3  
  3         16  
8             with 'Erlang::Parser::Node';
9              
10             has 'bexprs' => (is => 'rw', required => 1, isa => 'ArrayRef[Erlang::Parser::Node::BinaryExpr]');
11              
12             sub print {
13 1950     1950 1 1976 my ($self, $fh, $depth) = @_;
14 1950   100     2658 $depth ||= 0;
15              
16 1950         2210 print $fh '<<';
17              
18 1950         1544 my $first = 1;
19 1950         1467 foreach (@{$self->bexprs}) {
  1950         48013  
20 3270 100       3762 if ($first) { $first = 0 } else { print $fh ', ' }
  1884         1704  
  1386         1479  
21 3270         6828 $_->print($fh, $depth);
22             }
23              
24 1950         4237 print $fh '>>';
25             }
26              
27             __PACKAGE__->meta->make_immutable;
28              
29             =head1 NAME
30              
31             Erlang::Parser::Node::Binary - a binary string or list
32              
33             =head1 DESCRIPTION
34              
35             A compactly-stored block of data.
36              
37             =head2 Accessors
38              
39             =over 4
40              
41             =item C<bexprs>
42              
43             A list of L<Erlang::Parser::BinaryExpr>s; the individual expressions are
44             composed to create the binary string or list.
45              
46             =back
47              
48             =head2 Methods
49              
50             =over 4
51              
52             =item C<print>
53              
54             Pretty-prints the node to its filehandle argument.
55              
56             =back
57              
58             =head1 EXAMPLE
59              
60             <<"abc">>
61              
62             =cut
63              
64             1;
65              
66             # vim: set sw=4 ts=4: