line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Venus::Role::Unpackable; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
18
|
use 5.018; |
|
1
|
|
|
|
|
3
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use Venus::Role 'with'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# METHODS |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub unpack { |
13
|
3
|
|
|
3
|
1
|
10
|
my ($self, @args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
|
|
518
|
require Venus::Unpack; |
16
|
|
|
|
|
|
|
|
17
|
3
|
|
|
|
|
21
|
my $name = (caller(1))[3] =~ s/.*::(\w+)$/$1/gr; |
18
|
|
|
|
|
|
|
|
19
|
3
|
|
|
|
|
15
|
return Venus::Unpack->from($self)->name($name)->do('args', @args)->all; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# EXPORTS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub EXPORT { |
25
|
1
|
|
|
1
|
0
|
4
|
['unpack'] |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 NAME |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Venus::Role::Unpackable - Unpackable Role |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 ABSTRACT |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Unpackable Role for Perl 5 |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
package Example; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
use Venus::Class; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
with 'Venus::Role::Unpackable'; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub execute { |
53
|
|
|
|
|
|
|
return shift; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
package main; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my $example = Example->new; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# $example->unpack("hello", 123, 1.23)->signature( |
61
|
|
|
|
|
|
|
# 'string', 'number', 'float', |
62
|
|
|
|
|
|
|
# ); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 DESCRIPTION |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This package modifies the consuming package and provides methods for unpacking |
69
|
|
|
|
|
|
|
and validating argument lists. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 METHODS |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This package provides the following methods: |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 unpack |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
unpack(Any @args) (Venus::Unpack) |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
The unpack method passes the arguments provided to L for |
84
|
|
|
|
|
|
|
unpacking and validating arbitrary argument lists. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
I> |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=over 4 |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item unpack example 1 |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
package main; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
my $example = Example->new; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
my $results = $example->unpack("hello", 123, 1.23)->signature( |
97
|
|
|
|
|
|
|
'any', |
98
|
|
|
|
|
|
|
); |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# ["hello", 123, 1.23] |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=back |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=over 4 |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item unpack example 2 |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
package main; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my $example = Example->new; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
my $results = $example->unpack("hello", 123, 1.23)->signature( |
113
|
|
|
|
|
|
|
'string', |
114
|
|
|
|
|
|
|
'number | float', |
115
|
|
|
|
|
|
|
); |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# ["hello", 123, 1.23] |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=back |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=over 4 |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item unpack example 3 |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
package main; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
my $example = Example->new; |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
my $results = $example->unpack("hello", 123, 1.23)->signature( |
130
|
|
|
|
|
|
|
'string', |
131
|
|
|
|
|
|
|
'number', |
132
|
|
|
|
|
|
|
'float', |
133
|
|
|
|
|
|
|
); |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
# ["hello", 123, 1.23] |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=back |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=cut |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 AUTHORS |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Awncorp, C |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=cut |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 LICENSE |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Copyright (C) 2000, Al Newkirk. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under |
152
|
|
|
|
|
|
|
the terms of the Apache license version 2.0. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=cut |