blib/lib/Venus/Role/Unacceptable.pm

filter: Statementstmt 94.4% 17 / 18 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 77.4% 24 / 31 SCAR 11.1
CC
3
Cov
83%
BUILD
3.4
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« blib/lib/Venus/Role/Explainable.pm ↑ Summary blib/lib/Venus/Kind/Value.pm »
1 package Venus::Role::Unacceptable;
2  
3 1 ▶use 5.018;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Venus::Role 'raise';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # BUILDERS
11  
12 sub BUILD {
13 1 ▶ my ($self) = @_;
Subroutine BUILD: called CC=3 SCAR=12.3
Pod undocumented
14  
15 1 ▶ my $class = ref $self || $self;
Condition33%1/3
ref $self || $self
l!l&&r!l&&!r
100
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 1 my %attrs = map +($_, $_), $self->META->attrs;
17 1 my @unknowns = sort grep !exists($attrs{$_}), keys %$self;
18  
19 1 ▶ raise 'Venus::Role::Unacceptable::Error', {
Branch: 1 branch
BranchTrueFalseTotal
if @unknowns 1 0 1
20 name => 'on.build',
21 '$stash' => {unknowns => [@unknowns]},
22 message => "$class was passed unknown attribute(s): " . join ', ',
23 map "'$_'", @unknowns,
24 }
25 if @unknowns;
26  
27 0 return $self;
28 }
29  
30 1 1;
31  
32  
33  
34 =head1 NAME
35  
36 Venus::Role::Unacceptable - Unacceptable Role
37  
38 =cut
39  
40 =head1 ABSTRACT
41  
42 Unacceptable Role for Perl 5
43  
44 =cut
45  
46 =head1 SYNOPSIS
47  
48 package ExampleAccept;
49  
50 use Venus::Class 'attr';
51  
52 attr 'name';
53  
54 package ExampleDeny;
55  
56 use Venus::Class 'attr', 'with';
57  
58 with 'Venus::Role::Unacceptable';
59  
60 attr 'name';
61  
62 package main;
63  
64 my $example = ExampleDeny->new(name => 'example', test => 12345);
65  
66 # Exception! (isa Venus::Role::Unacceptable::Error)
67  
68 =cut
69  
70 =head1 DESCRIPTION
71  
72 This package provides a mechanism for raising an exception when unexpected
73 constructor arguments are encountered.
74  
75 =cut
76  
77 =head1 AUTHORS
78  
79 Awncorp, C<awncorp@cpan.org>
80  
81 =cut
82  
83 =head1 LICENSE
84  
85 Copyright (C) 2000, Awncorp, C<awncorp@cpan.org>.
86  
87 This program is free software, you can redistribute it and/or modify it under
88 the terms of the Apache license version 2.0.
89  
90 =cut
« blib/lib/Venus/Role/Explainable.pm ↑ Summary blib/lib/Venus/Kind/Value.pm »