bardecode.com

  • Increase font size
  • Default font size
  • Decrease font size
Home Knowledge Base Perl module for linux version

Perl module for linux version

The SoftekBarcode Perl Module enables you to read barcodes from image files in Perl scripts and is now included as a standard component of the Softek Barcode Reader Toolkit for Linux.

Installation

From within the perl folder in the download tar ball:

Installation follows the usual pattern for Perl Modules:

perl Makefile.PL
make
make test
make install

Sample Code

#!/usr/bin/perl
use strict ;
use SoftekBarcode ;

my $file = "../image/code39_01.tif" ;
my $bar = new SoftekBarcode ;
# Set some properties.
$bar->{ReadCode39} = 1 ;
$bar->{ReadCode128} = 0 ;
my $count = $bar->ScanBarCode($file) ;

if ($count < 0)
{
        print "Error opening $file\n" ;
}
elsif ($count)
{
        printf "Found %d barcodes\n", $count ;
        foreach (1..$count)
        {
                my $barcode = $bar->GetBarString($_) ;
                printf "Barcode %d = %s\n", $_, $barcode ;
        }
}
else
{
        printf "No barcodes found in this image\n" ;
}