blib/lib/Venus/Role/Unpackable.pm

filter: Statementstmt 100% 17 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 50.0% 1 / 2 totaltotal 96.0% 24 / 25 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Venus/Role/Superable.pm ↑ Summary blib/lib/Venus/Float.pm »
1 package Venus::Role::Unpackable;
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 # METHODS
11  
12 sub unpack {
13 3 ▶ my ($self, @args) = @_;
Subroutine unpack: called CC=1 SCAR=0.0
Pod documented
14  
15 3 require Venus::Unpack;
16  
17 3 my $name = (caller(1))[3] =~ s/.*::(\w+)$/$1/gr;
18  
19 3 return Venus::Unpack->from($self)->name($name)->do('args', @args)->all;
20 }
21  
22 # EXPORTS
23  
24 sub EXPORT {
25 1 ▶ ['unpack']
Subroutine EXPORT: called CC=1 SCAR=0.0
Pod undocumented
26 }
27  
28 1 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<Venus::Unpack> for
84 unpacking and validating arbitrary argument lists.
85  
86 I<Since C<2.01>>
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<awncorp@cpan.org>
144  
145 =cut
146  
147 =head1 LICENSE
148  
149 Copyright (C) 2000, Awncorp, C<awncorp@cpan.org>.
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
« blib/lib/Venus/Role/Superable.pm ↑ Summary blib/lib/Venus/Float.pm »