GD::Ba...:EAN13(3pm)
π GD::Barcode::EAN13 β the vibe π
okay bestie, so this little page is the manual for a Perl module that lives in the User Contributed Perl Documentation section, and it's called GD::Barcode::EAN13. You know, the one that makes EAN13 (aka JAN13) barcode pics with GD?? yeah. that one. let's get into it πβ¨
π NAME π
GD::Barcode::EAN13 β bestie it literally makes EAN13(JAN13) barcode images and it does it with GD. that's the whole gig π
πΈ SYNOPSIS πΈ
k so example numero uno, the CGI moment, ok:
use GD::Barcode::EAN13;
binmode(STDOUT);
print "Content-Type: image/png\n\n";
print GD::Barcode::EAN13->new('123456789012')->plot->png;
and here's the same thing but with error check energy, because we love a safe queen π«Ά
my $oGdBar = GD::Barcode::EAN13->new('123456789');
die $GD::Barcode::EAN13::errStr unless($oGdBar); #Invalid Length
like... #Invalid Length is genuinely so real of it. it will simply die on you if the length is wrong. no cap. π
π¦ DESCRIPTION π¦
so GD::Barcode::EAN13 is a subclass of GD::Barcode, right? and its whole purpose in life is letting you create EAN13(JAN13) barcode images with GD. iconic behavior honestly.
also PSA: this module is based on "Generate Barcode Ver 1.02 By Shisei Hanai 97/08/22". cute legacy vibes π
β¨ new
$oGdBar = GD::Barcode::EAN13->new($sTxt);
the constructor!! it creates a GD::Barcode::EAN13 object for $sTxt. and here's the tea: $sTxt has to be 12 or 13 numeric characters ([0-9]). that's the rule, fr fr.
and if $sTxt has 12 characters, this module calculates CD for you. thoughtful. generous. we stan π₯°
β¨ plot()
$oGd = $oGdBar->plot([Height => $iHeight, NoText => 0 | 1]);
this one creates a GD object with the barcode image for the $sTxt you specified back at new. $iHeight is, shocking twist, the height of the image. and if NoText is 1, the image has no text image of $sTxt. (yes it's a double "image", it said what it said π)
example time:
my $oGdB = GD::Barcode::EAN13->new('123456789012');
my $oGD = $oGdB->plot(NoText=>1, Height => 20);
# $sGD is a GD image with Height=>20 pixels, with no text.
so like. you get a 20-pixel-tall image and it's text-free. minimalism. ate. π
β¨ barcode()
$sPtn = $oGdBar->barcode();
returns a barcode pattern as a string built out of '1', 'G' and '0'. the decoder ring is:
'1'means black'G'also means black, but a lil bit long π (little bit long. ok periodt)'0'means white
example:
my $oGdB = GD::Barcode::EAN13->new('123456789012');
my $sPtn = $oGdB->barcode();
# $sPtn = '';
lol yes the example literally shows $sPtn = ''; β that's what it says, bestie. i'm not out here editing the source material. π
β¨ $errStr
$GD::Barcode::EAN13::errStr
this bad boy has the error message. when something goes wrong, this is where the drama lives. π
β¨ $text
$oGdBar->{$text}
has the barcode text based on the $sTxt you specified in the new method. like it remembers what you gave it. loyal. π
π AUTHOR π
Kawai Takanori β GCD00051@nifty.ne.jp
π COPYRIGHT π
The GD::Barocde::EAN13 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.
(and yes, GD::Barocde is spelled exactly like that in the original. i said what i said. not my typo, not my problem π)
β SEE ALSO β
GD::Barcode
that's the whole page bestie, go forth and generate barcodes responsibly π₯
sign-off realness: this was perl v5.40.1, dated 2025-10-27, and it's the GD::Barcode::EAN13(3pm) page from the User Contributed Perl Documentation. mwah πβ¨
π¦ 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