--- loncom/cgi/barcode.png 2001/08/15 14:03:15 1.2 +++ loncom/cgi/barcode.png 2001/09/28 20:26:02 1.3 @@ -32,12 +32,19 @@ Content-type: image/gif END +unless(defined($ENV{'form.encode'}) and length($ENV{'form.encode'})) { + $ENV{'form.encode'}='***ERROR***UNDEFINED***'; +} + my $oGdBar=GD::Barcode::Code39->new($ENV{'form.encode'}); -warn($GD::Barcode::errStr); +if ($GD::Barcode::errStr or !defined($oGdBar)) { + warn($GD::Barcode::errStr); + $oGdBar=GD::Barcode::Code39->new('***ERROR***INVALID***'); +} my $bindata=$oGdBar->plot->png; # create barcode image undef $oGdBar; binmode(STDOUT); -open OUT,"|pngtopnm|ppmtogif"; # convert into a gif image +open OUT,"|pngtopnm|ppmtogif 2>/dev/null"; # convert into gif image print OUT $bindata; # output image $|=1; # be sure to flush before closing close OUT;