{"id":15286202,"url":"https://github.com/jonasbn/bdkpo","last_synced_at":"2026-03-07T06:31:13.779Z","repository":{"id":56835087,"uuid":"14954250","full_name":"jonasbn/bdkpo","owner":"jonasbn","description":"Business::DK::PO - Danish postal order code generator/validator","archived":false,"fork":false,"pushed_at":"2025-05-25T17:08:56.000Z","size":100,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-10T09:07:05.212Z","etag":null,"topics":["hacktoberfest","perl","perl5","validation"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonasbn.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-12-05T13:30:28.000Z","updated_at":"2025-05-25T17:08:31.000Z","dependencies_parsed_at":"2024-09-30T15:12:03.664Z","dependency_job_id":"01c6d18e-8493-4b1c-b73b-5168c2bd0755","html_url":"https://github.com/jonasbn/bdkpo","commit_stats":{"total_commits":85,"total_committers":5,"mean_commits":17.0,"dds":0.5176470588235293,"last_synced_commit":"0dbfe46f79b8ee68f829fdc6c5464c22b31b476f"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/jonasbn/bdkpo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonasbn%2Fbdkpo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonasbn%2Fbdkpo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonasbn%2Fbdkpo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonasbn%2Fbdkpo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonasbn","download_url":"https://codeload.github.com/jonasbn/bdkpo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonasbn%2Fbdkpo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30209086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T05:23:27.321Z","status":"ssl_error","status_checked_at":"2026-03-07T05:00:17.256Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","perl","perl5","validation"],"created_at":"2024-09-30T15:10:56.833Z","updated_at":"2026-03-07T06:31:13.733Z","avatar_url":"https://github.com/jonasbn.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nBusiness::DK::PO - Danish postal order number validator\n\n# VERSION\n\nThis documentation describes version 0.07\n\n# SYNOPSIS\n\n    use Business::DK::PO qw(validate);\n\n    my $rv;\n    eval {\n        $rv = validate(1234563891234562);\n    };\n\n    if ($@) {\n        die \"Code is not of the expected format - $@\";\n    }\n\n    if ($rv) {\n        print \"Code is valid\";\n    } else {\n        print \"Code is not valid\";\n    }\n\n\n    use Business::DK::PO qw(calculate);\n\n    my $code = calculate(1234);\n\n\n    #Using with Params::Validate\n\n    use Params::Validate qw(:all);\n    use Business::DK::PO qw(validatePO);\n\n    sub check_cpr {\n        validate( @_,\n        { po =\u003e\n            { callbacks =\u003e\n                { 'validate_po' =\u003e sub { validatePO($_[0]); } } } } );\n\n        print $_[1].\" is a valid PO\\n\";\n\n    }\n\n# DESCRIPTION\n\nThe postal orders and postal order codes are used by the danish postal service\n**PostDanmark**.\n\n# SUBROUTINES/METHODS\n\n## validate\n\nThe function takes a single argument, a 16 digit postal order code.\n\nThe function returns 1 (true) in case of a valid postal order code argument and\n0 (false) in case of an invalid postal order code argument.\n\nThe validation function goes through the following steps.\n\nValidation of the argument is done using the functions (all described below in\ndetail):\n\n- \\_argument\n- \\_content\n- \\_length\n\nIf the argument is a valid argument the sum is calculated by **\\_calculate\\_sum**\nbased on the argument and the controlcifers array.\n\nThe sum returned is checked using a modulus caluculation and based on its\nvalidity either 1 or 0 is returned.\n\n## validatePO\n\nA wrapper for [\"validate\"](#validate) with a name more suitable for importing, it is less\ncommon and therefor less intrusive.\n\nSee [\"validate\"](#validate) for details.\n\n## calculate\n\nThe function takes a single argument, an integer indicating a unique reference\nnumber you can use to identify an order. Suggestions are invoice number,\norder number or similar.\n\nThe number provided must be between 1 and 15 digits long, meaning a number\nbetween 1 and 999 trillions.\n\nThe function returns a postal order code consisting of the number given as\nargument appended with a control cifer to make the code valid (See: b\u0026lt;validate\u003e\n\nThe calculation function goes through the following steps.\n\nValidation of the argument is done using the functions (all described below in\ndetail):\n\n- \\_argument\n- \\_content\n- \\_length\n\nIf the argument is a valid argument the sum is calculated by **\\_calculate\\_sum**\nbased on the argument and the controlcifers array.\n\nBased on the sum the argument the controlcifer is calculated and appended so\nthat the argument becomes a valid postal order code.\n\nThe calculated and valid code is then returned, left-padded with zeroes to make\nit 16 digits long (SEE: validate).\n\n# PRIVATE SUBROUTINES/METHODS\n\n## \\_argument\n\nThis function is called from either **validate** or **calculate** if an argument\nis not provided.\n\nIt dies with an error message indicating the exceptional situation and attempts\nto guide the user to providing a sensible input.\n\nThe **\\_argument** function takes two arguments:\n\n- minimum length required of number (mandatory)\n- maximum length required of number (optional)\n\nThe arguments are used in the error message issued with **die**, since this\nmethod always dies.\n\n## \\_content\n\nThis function validates the content of the argument, it croaks if the argument\nis not an integer (consisting of digits only).\n\n## \\_length\n\nThis function validates the length of the argument, it dies if the argument\ndoes not fit wihtin the boundaries specified by the arguments provided:\n\nThe **\\_length** function takes the following arguments:\n\n- number (mandatory), the number to be validated\n- minimum length required of number (mandatory)\n- maximum length required of number (optional)\n\n## \\_calculate\\_sum\n\nThis function takes an integer and calculates the sum bases on the the\ncontrolcifer array.\n\n# EXPORTS\n\nBusiness::DK::PO exports on request:\n\n- [\"validate\"](#validate)\n- [\"validatePO\"](#validatepo)\n- [\"calculate\"](#calculate)\n- [\"\\_argument\"](#_argument)\n- [\"\\_content\"](#_content)\n- [\"\\_length\"](#_length)\n- [\"\\_calculate\\_sum\"](#_calculate_sum)\n\n# TESTS\n\nCoverage of the test suite is at 100%\n\n    ---------------------------- ------ ------ ------ ------ ------ ------ ------\n    File                           stmt   bran   cond    sub    pod   time  total\n    ---------------------------- ------ ------ ------ ------ ------ ------ ------\n    blib/lib/Business/DK/PO.pm    100.0  100.0    n/a  100.0  100.0  100.0  100.0\n    Total                         100.0  100.0    n/a  100.0  100.0  100.0  100.0\n    ---------------------------- ------ ------ ------ ------ ------ ------ ------\n\nTest::Kwalitee passes\n\nTest::Perl::Critic passes at severity 1, brutal, with many policies disabled\nthough, see `/perlcriticrc`.\n\n# BUGS\n\nPlease report issues via CPAN RT:\n\n    http://rt.cpan.org/NoAuth/Bugs.html?Dist=Business-DK-PO\n\nor by sending mail to\n\n    bug-Business-DK-PO@rt.cpan.org\n\n# SEE ALSO\n\n- [http://www.bgbank.dk/bfBlankethaandbog](http://www.bgbank.dk/bfBlankethaandbog)\n- bin/calculate\\_po.pl\n- bin/validate\\_po.pl\n\n# AUTHOR\n\nJonas B. Nielsen, (jonasbn) - `\u003cjonasbn@cpan.org\u003e`\n\n# COPYRIGHT\n\nBusiness-DK-PO is (C) by Jonas B. Nielsen, (jonasbn) 2006-2014\n\nBusiness-DK-PO is released under the artistic license\n\nThe distribution is licensed under the Artistic License, as specified\nby the Artistic file in the standard perl distribution\n(http://www.perl.com/language/misc/Artistic.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonasbn%2Fbdkpo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonasbn%2Fbdkpo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonasbn%2Fbdkpo/lists"}