blib/lib/Venus/Role/Rejectable.pm

filter: Statementstmt 100% 17 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 95.6% 22 / 23 SCAR 6.9
CC
2
Cov
100%
BUILD
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« blib/lib/Venus/Role/Valuable.pm ↑ Summary blib/lib/Venus/Role/Boxable.pm »
1 package Venus::Role::Rejectable;
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 'with';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # BUILDERS
11  
12 sub BUILD {
13 1 ▶ my ($self) = @_;
Subroutine BUILD: called CC=2 SCAR=6.9
Pod undocumented
14  
15 1 my %attrs = map +($_, $_), $self->META->attrs;
16 1 my @unknowns = sort grep !exists($attrs{$_}), keys %$self;
17 1 delete $self->{$_} for @unknowns;
18  
19 1 return $self;
20 }
21  
22 1 1;
23  
24  
25  
26 =head1 NAME
27  
28 Venus::Role::Rejectable - Rejectable Role
29  
30 =cut
31  
32 =head1 ABSTRACT
33  
34 Rejectable Role for Perl 5
35  
36 =cut
37  
38 =head1 SYNOPSIS
39  
40 package ExampleAccept;
41  
42 use Venus::Class 'attr';
43  
44 attr 'name';
45  
46 package ExampleReject;
47  
48 use Venus::Class 'attr', 'with';
49  
50 with 'Venus::Role::Rejectable';
51  
52 attr 'name';
53  
54 package main;
55  
56 my $example = ExampleReject->new(name => 'example', test => 12345);
57  
58 # bless({name => 'example'}, "Example")
59  
60 =cut
61  
62 =head1 DESCRIPTION
63  
64 This package provides a mechanism for rejecting unexpected constructor arguments.
65  
66 =cut
67  
68 =head1 AUTHORS
69  
70 Awncorp, C<awncorp@cpan.org>
71  
72 =cut
73  
74 =head1 LICENSE
75  
76 Copyright (C) 2000, Awncorp, C<awncorp@cpan.org>.
77  
78 This program is free software, you can redistribute it and/or modify it under
79 the terms of the Apache license version 2.0.
80  
81 =cut
« blib/lib/Venus/Role/Valuable.pm ↑ Summary blib/lib/Venus/Role/Boxable.pm »