NAME

Business::DK::CVR - Danish CVR (VAT Registration) code generator/validator

VERSION

This documentation describes version 0.06 of Business::DK::CVR

SYNOPSIS

use Business::DK::CVR qw(validate);

        my $rv;
        eval { $rv = validate(27355021); };

        if ($@) {
            die "Code is not of the expected format - $@";
        }

        if ($rv) {
            print "Code is valid";
        } else {
            print "Code is not valid";
        }

        #Using with Params::Validate
        #See also examples/
    
        use Params::Validate qw(:all);
        use Business::DK::CVR qw(validateCVR);
    
        eval {
            check_cvr(cvr => 27355021);
        };
    
        if ($@) {
            print "CVR is not valid - $@\n";
        }
    
        eval {
            check_cvr(cvr => 27355020);
        };
    
        if ($@) {
            print "CVR is not valid - $@\n";
        }
    
        sub check_cvr {
            validate( @,
            { cvr =>
                { callbacks =>
                    { 'validatecvr' => sub { validateCVR($_[0]); } } } } );
        
            print $_[1]." is a valid CVR\n";
    
        }

DESCRIPTION

CVR is a company registration number used in conjuction with VAT handling in Denmark.

If you want to use this module in conjunction please check: Data::FormValidator::Constraints::Business::DK::CVR

SUBROUTINES AND METHODS
validate
The function takes a single argument, a 10 digit CVR number.

The function returns 1 (true) in case of a valid CVR number argument and 0 (false) in case of an invalid CVR number argument.

If the argument is a valid argument the sum is calculated by calculatesum based on the argument and the controlcifers array.

The sum returned is checked using a modulus caluculation and based on its validity either 1 or 0 is returned.

validateCVR
Better name for export. This is just a wrapper for validate

generate
Generate is a function which generates valid CVR numbers, it is by no means an authority, since CVRs are generated and distributed by danish tax authorities, but it can be used to generate example CVRs for testing and so on.

PRIVATE FUNCTIONS
calculatesum
This function takes an integer and calculates the sum bases on the the controlcifer array.

EXPORTS

Business::DK::CVR exports on request:

validate
generate
calculatesum

DIAGNOSTICS

CONFIGURATION AND ENVIRONMENT

The module requires no special configuration or environment to run.

DEPENDENCIES

INCOMPATIBILITIES

The module has no known incompatibilities.

BUGS AND LIMITATIONS

The module has no known bugs or limitations.

TEST AND QUALITY

Coverage of the test suite is at 100%

TODO

BUG REPORTING

Please report issues via CPAN RT:

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Business-DK-CVR

or by sending mail to

bug-Business-DK-CVR@rt.cpan.org

SEE ALSO

http://www.cvr.dk/
Business::DK::PO
Business::DK::CPR
http://search.cpan.org/dist/Algorithm-CheckDigits http://search.cpan.org/~mamawe/Algorithm-CheckDigits-0.38/CheckDigits/M1 1_008.pm
Data::FormValidator::Constraints::Business::DK::CVR

AUTHOR

Jonas B. Nielsen, (jonasbn) - `<jonasbn@cpan.org>'

COPYRIGHT

Business-DK-CVR is (C) by Jonas B. Nielsen, (jonasbn) 2006-2011

LICENSE

Business-DK-CVR is released under the artistic license

The distribution is licensed under the Artistic License, as specified by the Artistic file in the standard perl distribution (http://www.perl.com/language/misc/Artistic.html).