Note that the object returned by new is actually of the type requested (or set by syspref). For example, C4::Barcodes::annual
The specific C4::Barcodes::* modules correspond to the autoBarcode syspref values.
The default behavior here in Barcodes should be essentially a more flexible version of "incremental".
To add a new barcode format, a developer should:
create a module in C4/Barcodes/, like C4/Barcodes/my_new_format.pm; add to the $types hashref in this file; add tests under the "t" directory; and edit autoBarcode syspref to include new type.
Each new module that needs differing behavior must override these subs:
new_object initial db_max parse
Or else the CLASS subs will be used.
The hash referenced can be thought of as the constructor farm for all the C4::Barcodes types. Each value should be a reference to a sub that calls the module constructor.
You would think it might be easy to handle incremental barcodes, but in practice even commonly used values, like the IBM "Boulder" format can cause problems for sprintf. Basically, the value is too large for the %d version of an integer, and we cannot count on perl having been compiled with support for quads (64-bit integers). So we have to use floats or increment a piece of it and return the rejoined fragments.