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