--- loncom/cgi/barcode.png 2003/02/03 18:03:52 1.11 +++ loncom/cgi/barcode.png 2005/04/07 06:56:21 1.12 @@ -3,7 +3,7 @@ # The LearningOnline Network with CAPA # barcode.png - A CGI script that dynamically outputs a barcode. # -# $Id: barcode.png,v 1.11 2003/02/03 18:03:52 harris41 Exp $ +# $Id: barcode.png,v 1.12 2005/04/07 06:56:21 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -27,9 +27,6 @@ # # http://www.lon-capa.org/ # -# YEAR=2001 -# 8/15,9/28,12/11 -# ### # I'm using format=Code39. @@ -43,12 +40,13 @@ use strict; use GD::Barcode::Code39; $|=1; # Autoflush after each print/write +my %env; foreach (split(/&/,$ENV{'QUERY_STRING'})) { my ($name, $value) = split(/=/,$_); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; if ($name eq 'encode') { - $ENV{'form.'.$name}=$value; + $env{'form.'.$name}=$value; } } @@ -58,10 +56,10 @@ Content-type: image/png END -unless(defined($ENV{'form.encode'}) and length($ENV{'form.encode'})) { - $ENV{'form.encode'}='***ERROR***UNDEFINED***'; +unless(defined($env{'form.encode'}) and length($env{'form.encode'})) { + $env{'form.encode'}='***ERROR***UNDEFINED***'; } -my $text = '*'.uc($ENV{'form.encode'}).'*'; +my $text = '*'.uc($env{'form.encode'}).'*'; my $oGdBar=GD::Barcode::Code39->new($text); if ($GD::Barcode::errStr or !defined($oGdBar)) { warn($GD::Barcode::errStr);