#!/usr/bin/perl
use strict;
use warnings;
use GD::Barcode::Code39;
my $oGdBar = GD::Barcode->new('Code39', "*$customer{id}*");
#my $oGdBar = GD::Barcode::Code39->new("*$customer{id}*");
if ( !$oGdBar ) {
display_menu_error("ERROR: $GD::Barcode::Code39::errStr \n");
}
print "PTN:", $oGdBar->{text}, ":", $oGdBar->barcode(), "\n";
#FIXME prints out error "Can't locate object method "Small" via packag
+e "GD::Font" (perhaps you forgot
#to load "GD::Font"?) at /usr/local/share/perl5/GD/Barcode/Code39.pm l
+ine 111, <> line 19."
my $output = '/tmp/Code39.png';
open my $OUTFILE, '>', $output;
binmode $OUTFILE;
print {$OUTFILE} $oGdBar->plot->png;
close {$OUTFILE};
undef $oGdBar;
undef $OUTFILE;
undef $output;
system "lpr -r $output";
Not sure what mistake it is I am making here, I thought I followed the documentation to the letter. Ether way the barcode is being generated I can tell this because of the output from $oGdBar->barcode(), but the /tmp/Code39.png file is empty.
|