GD::Ba...e::UPCA(3pm)

πŸ’– NAME πŸ’–

GD::Barcode::UPCA β€” Create UPC-A barcode image with GD.

(Also, hi, this is the GD::Ba...e::UPCA(3pm) page β€” the header truncates the name like that, but it's the GD::Barcode::UPCA module, section 3pm, from User Contributed Perl Documentation. πŸŽ€)


✨ SYNOPSIS ✨

okay so, CGI vibes first:

use GD::Barcode::UPCA;
binmode(STDOUT);
print "Content-Type: image/png\n\n";
print GD::Barcode::UPCA->new('12345678901')->plot->png;

and now with Error Check, because we are responsible girlies:

my $oGdBar = GD::Barcode::UPCA->new('123456789');
die $GD::Barcode::UPCA::errStr unless($oGdBar);       #Invalid Length

πŸ¦‹ DESCRIPTION πŸ¦‹

GD::Barcode::UPCA is a subclass of GD::Barcode, and it allows you to create UPC-A barcode image with GD. This module is based on "Generate Barcode Ver 1.02 By Shisei Hanai 97/08/22". πŸ’«

πŸŽ€ new πŸŽ€

$oGdBar = GD::Barcode::UPCA->new($sTxt);

Constructor, bestie. Creates a GD::Barcode::UPCA object for $sTxt. $sTxt has 11 or 12 numeric characters ([0-9]). If $sTxt has 11 characters, this module calculates CD for you. the way it just does that for u πŸ₯Ή

πŸŽ€ plot() πŸŽ€

$oGd = $oGdBar->plot([Height => $iHeight, NoText => 0 | 1]);

Creates a GD object with barcode image for the $sTxt specified at new method.

  • Height => $iHeight β€” $iHeight is height of the image.
  • NoText => 0 | 1 β€” if NoText is 1, the image has no text image of $sTxt.

ex. πŸ“

my $oGdB = GD::Barcode::UPCA->new('12345678901');
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 string with '1', 'G' and '0'. '1' means black, 'G' also means black but little bit long, '0' means white. periodt πŸ’…

ex.

my $oGdB = GD::Barcode::UPCA->new('12345678901');
my $sPtn = $oGdB->barcode();
# $sPtn = '';

πŸŽ€ $errStr πŸŽ€

$GD::Barcode::UPCA::errStr

has error message. that's it, that's her job. when stuff goes wrong she will tell u 😭

πŸŽ€ $text πŸŽ€

$oGdBar->{$text}

has barcode text based on $sTxt specified in new method. iconic πŸ”₯


πŸ‘‘ AUTHOR πŸ‘‘

Kawai Takanori GCD00051@nifty.ne.jp


The GD::Barocde::UPCA 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.


🌈 SEE ALSO 🌈

GD::Barcode


okay that's the whole page, no notes πŸ’– this was perl v5.40.1, dated 2025-10-27, and it lives in the GD::Ba...e::UPCA(3pm) manual. go make some barcodes, bestie 🫢✨

πŸ“¦ where this page comes from