.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Business::BR::Ids::Common 3pm" .TH Business::BR::Ids::Common 3pm "2022-10-13" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Business::BR::Ids::Common \- Common code used in Business\-BR\-Ids modules .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& use Business::BR::Ids::Common qw(_dot _canon_i _canon_id); \& my @digits = (1, 2, 3, 3); \& my @weights = (2, 5, 2, 6); \& my $dot = _dot(\e@weights, \e@digits); # computes 2*1+5*2+2*3+6*3 = 36 \& \& # computes the sum of digits of ( 2*1, 5*2, 2*3, 6*3 ) \& # which is 2 + (1 + 0) + 6 + (1 + 8) = 18 \& my $s = _dot_10(\e@weights, \e@digits); \& \& _canon_i(342222, size => 7); # returns \*(Aq0342222\*(Aq \& _canon_i(\*(Aq12.28.8\*(Aq, size => 5); # returns \*(Aq12288\*(Aq \& \& _canon_i(342222, size => 7); # returns \*(Aq0342222\*(Aq \& _canon_i(\*(Aq12.28.8\*(Aq, size => 5); # returns \*(Aq12288\*(Aq \& _canon_id(\*(AqA12.3\-B\*(Aq, size => 5); # returns \*(AqA123B\*(Aq .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module is meant to be private for Business-BR-Ids distributions. It is a common placeholder for code which is shared among other modules of the distribution. .PP Actually, the only code here is the computation of the scalar product between two array refs. In the future, this module can disappear being more aptly named and even leave the Business::BR namespace. .IP "\fB_dot\fR" 4 .IX Item "_dot" .Vb 1 \& $s = _dot(\e@a, \e@b); .Ve .Sp Computes the scalar (or dot) product of two array refs: .Sp .Vb 1 \& sum( a[i]*b[i], i = 0..$#a ) .Ve .Sp Note that due to this definition, the second argument should be at least as long as the first argument. .IP "\fB_dot_10\fR" 4 .IX Item "_dot_10" .Vb 1 \& $s = _dot_10(\e@a, \e@b); .Ve .Sp Computes the product of corresponding elements in the array refs and then takes the sum of its digits. (Used for computing \s-1IE/MG.\s0) .IP "\fB_canon_i\fR" 4 .IX Item "_canon_i" .Vb 1 \& $qs = _canon_i($s, size => 8) .Ve .Sp If the argument is a number, formats it to the specified size. Then, strips any non-digit character. If the argument is a string, it just strips non-digit characters. .IP "\fB_canon_id\fR" 4 .IX Item "_canon_id" .Vb 1 \& $qs = _canon_id($s, size => 8) .Ve .Sp If the argument is a number, formats it to the specified size. Then, strips any non-digit character. If the argument is a string, it just strips characters matching \f(CW\*(C`/[\eW_]/\*(C'\fR. .SS "\s-1EXPORT\s0" .IX Subsection "EXPORT" None by default. .PP You can explicitly ask for \f(CW\*(C`_dot()\*(C'\fR which is a sub to compute the dot product between two array refs (used for computing check digits). There are also \&\f(CW\*(C`_dot_10\*(C'\fR, \f(CW\*(C`_canon_i\*(C'\fR and \f(CW\*(C`_canon_id\*(C'\fR to be exported on demand. .SH "SEE ALSO" .IX Header "SEE ALSO" Please reports bugs via \s-1CPAN RT,\s0 http://rt.cpan.org/NoAuth/Bugs.html?Dist=Business\-BR\-Ids .SH "AUTHOR" .IX Header "AUTHOR" A. R. Ferreira, .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2005\-2007 by A. R. Ferreira .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.