Barcode Perl Module |
|
|
NAME
Barcode - version 1.5 Sat Sep 23 6:20:30 EDT 2000
Creates a barcode image as a png file object. Currently only does type Code 128 (B or C). Also decodes scans from the CueCat scanner and retrieves the url from a Digital Convergence server.
This module is part of the CueCat Project.
|
|
|
|
SYNOPSIS
use Barcode;
Class Code128 # create a Code 128 barcode my $barcode = Code128->new($bar_code,$quiet_zone,$polarity,$density, $dpi,$image_type,$description);
Class CodeISBN # return the ISBN number after previously decoding the barcode my $isbn = CodeISBN->encode($scan->{'barcode_data'});
Class Cuecat # decode a barcode with the decode method my $scan = CueCat->decode($scan_string);
# decode a barcode with the kdecode method my $scan = CueCat->kdecode;
# retrieve a url my $scan_string =
# encode data my $data = CueCat->encode($barcode_data);
|
|
|
|
DESCRIPTION
Creates a barcode image as a png object which you can then print or save to a file and decodes barcode scans from the CueCat scanner <www.cuecat.com> and can query the Digital Convergence database for a url.
Currently only creates type Code 128 barcodes. If the data string is an odd length or contains non-digit characters, Code B is used, otherwise Code C.
For more information on barcodes see BarCode1 http://www.adams1.com/pub/russadam/barcode1.html.
Class Code128 # create a Code 128 barcode my $barcode = Code128->new($bar_code,$quiet_zone,$polarity,$density, $dpi,$image_type,$description); where: $bar_code = string to be barcoded $quiet_zone = number of clear x-dimensions each end $polarity = bw (black on white) or wb (white on black) $density = width of individual bars in .001 inch $dpi = resolution of target printer $image_type = 'transparent' or 'interlaced' $description = optional description Returns the png file in $barcode->{'png_file'}.
Class CodeISBN Constructs the ISBN number from the raw barcode value on an ISBN barcode (this is the number found above the ISBN barcode).
# return the ISBN number after previously decoding the barcode my $isbn = CodeISBN->encode($scan->{'barcode_data'});
Returns $isbn->{'isbn_value'}.
Class Cuecat Two decode methods are provided: decode and kdecode.
CueCat->decode uses a perl decode routine on raw scan data from the CueCat. This method is NOT recommended on linux or any system using X-Windows due to the initial Alt-F10 sequence sent by the CueCat. It will work on a regular text console however, provided you do not have a virtual terminal set up on tty10.
CueCat->kdecode is a binding to the linux CueCat kernel driver and is the recommended method on linux. The kernel driver is available at http://oss.lineo.com/cuecat/.
# decode a barcode with the decode method my $scan = CueCat->decode($scan_string);
# decode a barcode with the kdecode method my $scan = CueCat->kdecode;
Returns $scan->{'barcode_type'} $scan->{'barcode_data'} and $scan->{'cuecat_ser_no'} in either method. If you call CueCat->kdecode inside a loop you must destroy the object created by calling $scan->destroy($scan->{'pid'}) before returning to the start of the loop.
CueCat->get_dc_cue will query a Digital Convergence server and return the url from the database. This method requires the raw (undecoded) string sent by the scanner. It will generate a random "activation code" in order to preserve the privacy of the user. If the url is not in DC's database it will return the url of a form to submit the barcode to DC.
# retrieve a url my $scan_string =
CueCat->encode will take decoded data and re-encode it to the raw scan data format. This allows users of the linux kernel driver to get a decoded scan from the driver and re-encode it in order to call CueCat->get_dc_cue.
# encode data my $data = CueCat->encode($barcode_data);
Returns $data->{'encoded'}. Note you must do this for all 3 pieces of the original scan string and then reconstruct the scan format. See the example file.
|
|
|
|
AUTHOR
D. Scott Barninger <barninger@cvn.net> http://www.b-wdesigngroup.com License: licensed under the same terms as Perl (Artistic License).
Based upon work by
Carl Sewell <csewell@hiwaay.net> http://home.hiwaay.net/~csewell/
Greg Kearney <gkearney@new-sharon.me.us> http://www.new-sharon.me.us/upc.html
Thanks to
Gene Drury <herbert6@cvn.net> for the professional logo. http://www.b-wdesigngroup.com |
|
|
|
This page has been accessed times since 09/19/2000 |