Board/Dumper.pm

filter: Statementstmt 25.6% 10 / 39 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 50.0% 2 / 4 Podpod 100% 1 / 1 totaltotal 21.3% 13 / 61 SCAR 43.4
CC
11
Cov
19%
dump
90.0
_dump_container
12.0
BEGIN
1.0
CRAP 76.5
↑ Summary Board/Service/Deferred.pm »
1 package Bread::Board::Dumper;
2 1 our $AUTHORITY = 'cpan:STEVAN';
3 # ABSTRACT: Pretty printer for visualizing the layout of your Bread::Board
4 1 $Bread::Board::Dumper::VERSION = '0.35';
5 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 sub dump {
8 0 ▶ my ($self, $thing, $indent) = @_;
Subroutine dump: not called CC=9 SCAR=45.0
Pod documented
9  
10 0 ▶ $indent = defined $indent ? $indent . ' ' : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $indent ? : 0 0 0
11  
12 0 my $output = '';
13  
14 0 ▶ if ($thing->isa('Bread::Board::Dependency')) {
Branch: 4 branches
BranchTrueFalseTotal
if ($thing->isa('Bread::Board::Dependency')) { } 0 0 0
elsif ($thing->does('Bread::Board::Service')) { } 0 0 0
elsif ($thing->isa('Bread::Board::Container')) { } 0 0 0
elsif ($thing->isa('Bread::Board::Container::Parameterized')) { } 0 0 0
15 0 ▶ $output .= join('', $indent, "depends_on: ", $thing->service_path || $thing->service->name, "\n");
Condition0%0/3
$thing->service_path || $thing->service->name
l!l&&r!l&&!r
000
MC/DC0%0/2
$thing->service_path || $thing->service->name
$thing->service_path $thing->service->name
Truth table0%0/3
A || B
A= $thing->service_pathB= $thing->service->name
ABresult
1X1
011
000
16 }
17 elsif ($thing->does('Bread::Board::Service')) {
18 0 $output .= join('', $indent, "service: ", $thing->name, "\n" );
19  
20 0 ▶ if ($thing->does('Bread::Board::Service::WithDependencies')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($thing->does("Bread::Board::Service::WithDependencies")) 0 0 0
21 0 my $deps = $thing->dependencies;
22 0 for my $key (sort keys %{$deps}) {
23 0 $output .= $self->dump($deps->{$key}, $indent);
24 }
25 }
26 }
27 elsif ($thing->isa('Bread::Board::Container')) {
28 0 $output = join('', $indent, "container: ", $thing->name, "\n" );
29  
30 0 $output .= $self->_dump_container($thing, $indent);
31 }
32 elsif ($thing->isa('Bread::Board::Container::Parameterized')) {
33 0 my $params = join ', ', @{ $thing->allowed_parameter_names };
34 0 $output = join('', $indent, "container: ", $thing->name, " [$params]\n" );
35 0 $output .= $self->_dump_container($thing, $indent);
36 }
37  
38 0 return $output;
39 }
40  
41 sub _dump_container {
42 0 ▶ my ($self, $c, $indent) = @_;
Subroutine _dump_container: not called CC=3 SCAR=24.8
43  
44 0 my $output = '';
45  
46 0 my $subs = $c->sub_containers;
47 0 for my $key (sort keys %{$subs}) {
48 0 $output .= $self->dump($subs->{$key}, $indent);
49 }
50  
51 0 my $services = $c->services;
52 0 for my $key (sort keys %{$services}) {
53 0 $output .= $self->dump($services->{$key}, $indent);
54 }
55  
56 0 return $output;
57 }
58  
59 1 __PACKAGE__->meta->make_immutable;
60  
61 1 ▶no Moose; 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
62  
63 __END__
64  
65 =pod
66  
67 =encoding UTF-8
68  
69 =head1 NAME
70  
71 Bread::Board::Dumper - Pretty printer for visualizing the layout of your Bread::Board
72  
73 =head1 VERSION
74  
75 version 0.35
76  
77 =head1 SYNOPSIS
78  
79 use Bread::Board::Dumper;
80  
81 print Bread::Board::Dumper->new->dump($container);
82  
83 # container: Application
84 # container: Controller
85 # container: View
86 # service: TT
87 # depends_on: include_path
88 # container: Model
89 # service: dsn
90 # service: schema
91 # depends_on: pass
92 # depends_on: ../dsn
93 # depends_on: user
94  
95 =head1 DESCRIPTION
96  
97 This is a useful utility for dumping a clean view of a Bread::Board
98 container.
99  
100 =head1 AUTHOR (actual)
101  
102 Daisuke Maki
103  
104 =head1 AUTHOR
105  
106 Stevan Little <stevan@iinteractive.com>
107  
108 =head1 BUGS
109  
110 Please report any bugs or feature requests on the bugtracker website
111 https://github.com/stevan/BreadBoard/issues
112  
113 When submitting a bug or request, please include a test-file or a
114 patch to an existing test-file that illustrates the bug or desired
115 feature.
116  
117 =head1 COPYRIGHT AND LICENSE
118  
119 This software is copyright (c) 2017, 2016, 2015, 2014, 2013, 2011, 2009 by Infinity Interactive.
120  
121 This is free software; you can redistribute it and/or modify it under
122 the same terms as the Perl 5 programming language system itself.
123  
124 =cut
↑ Summary Board/Service/Deferred.pm »