blib/lib/Venus/Role/Explainable.pm

filter: Statementstmt 94.1% 16 / 17 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 76.6% 23 / 30 SCAR 11.2
CC
3
Cov
82%
AUDIT
3.6
BEGIN
1.0
BEGIN
1.0
CRAP 3.1
« blib/lib/Venus/Role/Reflectable.pm ↑ Summary blib/lib/Venus/Role/Unacceptable.pm »
1 package Venus::Role::Explainable;
2  
3 96 ▶use 5.018;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 96 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 96 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 96 ▶use Venus::Role 'fault';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # AUDIT
11  
12 sub AUDIT {
13 202 ▶ my ($self, $from) = @_;
Subroutine AUDIT: called CC=3 SCAR=12.7
Pod undocumented
14  
15 202 ▶ my $name = ref $self || $self;
Condition33%1/3
ref $self || $self
l!l&&r!l&&!r
02020
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table33%1/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
16  
17 202 ▶ if (!$from->can('explain')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($from->can("explain")) 0 202 202
18 0 fault "${from} requires 'explain' to consume ${name}";
19 }
20  
21 202 return $self;
22 }
23  
24 96 1;
25  
26  
27  
28 =head1 NAME
29  
30 Venus::Role::Explainable - Explainable Role
31  
32 =cut
33  
34 =head1 ABSTRACT
35  
36 Explainable Role for Perl 5
37  
38 =cut
39  
40 =head1 SYNOPSIS
41  
42 package Example;
43  
44 use Venus::Class;
45  
46 attr 'test';
47  
48 sub explain {
49 "okay"
50 }
51  
52 with 'Venus::Role::Explainable';
53  
54 package main;
55  
56 my $example = Example->new(test => 123);
57  
58 # $example->explain;
59  
60 =cut
61  
62 =head1 DESCRIPTION
63  
64 This package modifies the consuming package and provides methods for making the
65 object stringifiable.
66  
67 =cut
68  
69 =head1 METHODS
70  
71 This package provides the following methods:
72  
73 =cut
74  
75 =head2 explain
76  
77 explain() (any)
78  
79 The explain method takes no arguments and returns the value to be used in
80 stringification operations.
81  
82 I<Since C<0.01>>
83  
84 =over 4
85  
86 =item explain example 1
87  
88 package main;
89  
90 my $example = Example->new(test => 123);
91  
92 my $explain = $example->explain;
93  
94 # "okay"
95  
96 =back
97  
98 =cut
99  
100 =head1 AUTHORS
101  
102 Awncorp, C<awncorp@cpan.org>
103  
104 =cut
105  
106 =head1 LICENSE
107  
108 Copyright (C) 2000, Awncorp, C<awncorp@cpan.org>.
109  
110 This program is free software, you can redistribute it and/or modify it under
111 the terms of the Apache license version 2.0.
112  
113 =cut
« blib/lib/Venus/Role/Reflectable.pm ↑ Summary blib/lib/Venus/Role/Unacceptable.pm »