Barcode::Code128 is a Perl module that can generate CODE 128 bar codes.
$code = new Barcode::Code128;
By default, nothing. However there are a number of constants that represent special characters used in the CODE 128 symbology that you may wish to include. For example if you are using the EAN-128 or UCC-128 code, the string to encode begins with the FNC1 character. To encode the EAN-128 string "00 0 0012345 555555555 8", you would do the following:
use Barcode::Code128 'FNC1';
$code = new Barcode::Code128;
To have this module export one or more of these characters, specify them on the use statement or use the special token ':all' instead to include all of them. Examples:
use Barcode::Code128 qw(FNC1 FNC2 FNC3 FNC4 Shift);
use Barcode::Code128 qw(:all);
Here is the complete list of the exportable characters. They are assigned to high-order ASCII characters purely arbitrarily for the purposes of this module; the values used do not reflect any part of the CODE 128 standard. Warning: Using the CodeA, CodeB, CodeC, StartA, StartB, StartC, and Stop codes may cause your barcodes to be invalid, and be rejected by scanners. They are inserted automatically as needed by this module.
CodeA 0xf4 CodeB 0xf5 CodeC 0xf6
FNC1 0xf7 FNC2 0xf8 FNC3 0xf9
FNC4 0xfa Shift 0xfb StartA 0xfc
StartB 0xfd StartC 0xfe Stop 0xff
Barcode::Code128 generates bar codes using the CODE 128 symbology. It can generate images in PNG or GIF format using the GD package, or it can generate a text string representing the barcode that you can render using some other technology if desired.
The intended use of this module is to create a web page with a bar code on it, which can then be printed out and faxed or mailed to someone who will scan the bar code. The application which spurred its creation was an expense report tool, where the employee submitting the report would print out the web page and staple the receipts to it, and the Accounts Payable clerk would scan the bar code to indicate that the receipts were received.
The default settings for this module produce a large image that can safely be FAXed several times and still scanned easily. If this requirement is not important you can generate smaller image using optional parameters, described below.
If you wish to generate images with this module you must also have the GD.pm module (written by Lincoln Stein, and available from CPAN) installed. Version 1.20 or higher of GD generates a PNG file, due to issues with the GIF patent. If you want to create a GIF, you must use version 1.19 or earlier of GD. However, most browsers have no trouble with PNG files.
If the GD module is not present, you can still use the module, but you will not be able to use its functions for generating images. You can use the barcode() method to get a string of "#" and " " (hash and space) characters, and use your own image-generating routine with that as input.
To use the the GD module, you will need to install it along with this module. You can obtain it from the CPAN (Comprehensive Perl Archive Network) repository of your choice under the directory authors/id/LDS. Visit http://www.cpan.org/ for more information about CPAN. The GD home page is: http://stein.cshl.org/WWW/software/GD/GD.html
· Perl 5.004
· GD (optional)