line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Venus::Role::Unacceptable; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
19
|
use 5.018; |
|
1
|
|
|
|
|
3
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use Venus::Role 'raise'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# BUILDERS |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub BUILD { |
13
|
1
|
|
|
1
|
0
|
2
|
my ($self) = @_; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
33
|
|
|
13
|
my $class = ref $self || $self; |
16
|
1
|
|
|
|
|
3
|
my %attrs = map +($_, $_), $self->META->attrs; |
17
|
1
|
|
|
|
|
4
|
my @unknowns = sort grep !exists($attrs{$_}), keys %$self; |
18
|
|
|
|
|
|
|
|
19
|
1
|
50
|
|
|
|
11
|
raise 'Venus::Role::Unacceptable::Error', { |
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; |
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 |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 LICENSE |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Copyright (C) 2000, Al Newkirk. |
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 |