line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::Types::CPF; |
2
|
1
|
|
|
1
|
|
44803
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
95
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
6
|
|
|
|
|
|
|
our $AUTHORITY = 'CPAN:TBR'; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
2279
|
use MooseX::Types -declare => ['CPF']; |
|
1
|
|
|
|
|
2270540
|
|
|
1
|
|
|
|
|
10
|
|
9
|
1
|
|
|
1
|
|
5574
|
use MooseX::Types::Moose qw(Str); |
|
1
|
|
|
|
|
23166
|
|
|
1
|
|
|
|
|
14
|
|
10
|
1
|
|
|
1
|
|
6789
|
use Business::BR::CPF; |
|
1
|
|
|
|
|
2635
|
|
|
1
|
|
|
|
|
146
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub _validate_cpf { |
13
|
0
|
|
|
0
|
|
|
my ($str) = @_; |
14
|
0
|
|
|
|
|
|
return test_cpf($str); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
subtype CPF, |
18
|
|
|
|
|
|
|
as Str, |
19
|
|
|
|
|
|
|
where { _validate_cpf($_) }, |
20
|
|
|
|
|
|
|
message { 'CPF is invalid' }; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
1; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
__END__ |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 NAME |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
MooseX::Types::CPF - CPF type for Moose classes |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 SYNOPSIS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
package Class; |
33
|
|
|
|
|
|
|
use Moose; |
34
|
|
|
|
|
|
|
use MooseX::Types::CPF qw(CPF); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has 'cpf' => ( is => 'ro', isa => CPF ); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
package main; |
39
|
|
|
|
|
|
|
Class->new( cpf => '000.000.000-00' ); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 DESCRIPTION |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
This module lets you constrain attributes to only contain CPF. |
44
|
|
|
|
|
|
|
No coercion is attempted. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 EXPORT |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
None by default, you'll usually want to request C<CPF> explicitly. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 AUTHOR |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Thiago Rondon C<< <thiago@aware.com.br> >> |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Aware TI (L<http://www.aware.com.br/>) |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 COPYRIGHT |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This program is Free software, you may redistribute it under the same |
59
|
|
|
|
|
|
|
terms as Perl itself. |