line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Venus::Role::Rejectable; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
18
|
use 5.018; |
|
1
|
|
|
|
|
4
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
6
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use Venus::Role 'with'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# BUILDERS |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub BUILD { |
13
|
1
|
|
|
1
|
0
|
3
|
my ($self) = @_; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
3
|
my %attrs = map +($_, $_), $self->META->attrs; |
16
|
1
|
|
|
|
|
5
|
my @unknowns = sort grep !exists($attrs{$_}), keys %$self; |
17
|
1
|
|
|
|
|
3
|
delete $self->{$_} for @unknowns; |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
|
|
11
|
return $self; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
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 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 LICENSE |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Copyright (C) 2000, Al Newkirk. |
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 |