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 $sTxt has 6 characters, this module adds '0' at the front of $sTxt, and calculates CD for you ✨
  • if $sTxt has 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


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