GD::Ba...e::UPCE(3pm)
π GD::Barcode::UPCE π
okay so bestie, you found GD::Barcode::UPCE(3pm) and honestly? iconic. this is the little module that makes UPC-E barcodes with GD, and it's about to be so easy for you, i promise π«Ά
β¨ NAME β¨
GD::Barcode::UPCE β Create UPC-E barcode image with GD. that's it, that's the whole job description, and it eats π
πΈ SYNOPSIS πΈ
ex. CGI
use GD::Barcode::UPCE;
binmode(STDOUT);
print "Content-Type: image/png\n\n";
print GD::Barcode::UPCE->new('123456')->plot->png;
with Error Check
my $oGdBar = GD::Barcode::UPCE->new('123456789');
die $GD::Barcode::UPCE::errStr unless($oGdBar); #Invalid Length
like, look at that error check. she knows '123456789' is too long and she is not afraid to say it π
π¦ DESCRIPTION π¦
GD::Barcode::UPCE is a subclass of GD::Barcode and it lets you create UPC-E barcode images with GD. no cap, that's the vibe.
lowkey important lore: this module is based on "Generate Barcode Ver 1.02 By Shisei Hanai 97/08/22". respect the ancestors π§
π new
$oGdBar = GD::Barcode::UPCE->new($sTxt);
the Constructor. she creates a GD::Barcode::UPCE object for $sTxt. so $sTxt needs 6 or 7 or 8 numeric characters ([0-9]), and here's the cute part:
- if
$sTxthas 6 characters, this module adds'0'at the front of$sTxt, and calculates CD for you β¨ - if
$sTxthas 7 characters, this module calculates CD for you π
she's doing the math so you don't have to. main character energy, fr fr.
π plot()
$oGd = $oGdBar->plot([Height => $iHeight, NoText => 0 | 1]);
creates a GD object with the barcode image for the $sTxt you specified back at the new method. $iHeight is the height of the image. and if NoText is 1, the image has no text image of $sTxt. bye bye words π
ex.
my $oGdB = GD::Barcode::UPCE->new('123456');
my $oGD = $oGdB->plot(NoText=>1, Height => 20);
# $sGD is a GD image with Height=>20 pixels, with no text.
π barcode()
$sPtn = $oGdBar->barcode();
returns a barcode pattern in a string using '1', 'G' and '0'. the breakdown:
'1'means black'G'ALSO means black but a little bit long π'0'means white
ex.
my $oGdB = GD::Barcode::UPCE->new('123456');
my $sPtn = $oGdB->barcode();
# $sPtn = '';
π $errStr
$GD::Barcode::UPCE::errStr
has the error message. when things go wrong, she tells you why. communication queen π
β $text
$oGdBar->{$text}
has the barcode text based on the $sTxt you specified in the new method.
π AUTHOR π
Kawai Takanori GCD00051@nifty.ne.jp
π COPYRIGHT π
The GD::Barocde::UPCE module is Copyright (c) 2000 Kawai Takanori. Japan. All rights reserved.
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
(yes the module name in the copyright line is spelled GD::Barocde::UPCE in the original β we're keeping it exactly as written, no edits, periodt π)
π SEE ALSO π
GD::Barcode
and that's the whole page bestie, you ate it up π«Ά this was perl v5.40.1, dated 2025-10-27 β go make some barcodes, you gorgeous genius πβ¨
π¦ where this page comes from
- ubuntu resolute: libgd-barcode-perl 2.02-1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- ubuntu stonking: libgd-barcode-perl 2.02-1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms