GD::Ba...OOP2of5(3pm)

✨ GD::Barcode::COOP2of5 ✨

okay bestie, so this page is literally GD::Barcode::COOP2of5(3pm) β€” a Perl module page, user-contributed docs vibe, and it's about making COOP2of5 barcode pics with GD. no cap, it's shorter than my patience for group projects, so let's get into it πŸ’…


🌸 NAME 🌸

GD::Barcode::COOP2of5 β€” create a COOP2of5 barcode image with GD πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

example: CGI, the classic

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

and the version with error checking, because we're responsible girlies:

my $oGdBar = GD::Barcode::COOP2of5->new('A12345678');
die $GD::Barcode::COOP2of5::errStr unless($oGdBar);   #Invalid Characters
$oGdBar->plot->png;

πŸ’– DESCRIPTION πŸ’–

GD::Barcode::COOP2of5 is a subclass of GD::Barcode, and what it does is let you create a COOP2of5 barcode image with GD. that's the whole assignment and it ate. πŸ‘‘


πŸŽ€ new πŸŽ€

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

this is the constructor, the main character moment where the object gets made πŸ’« it creates a GD::Barcode::COOP2of5 object for $sTxt. and heads up: $sTxt has numeric characters ([0-9]). that's the only kind of character it's accepting, no exceptions, periodt.


🫢 plot() 🫢

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

this one creates a GD object that has 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, then the image has no text image of $sTxt β€” like, the barcode is there, the words are not, iconic honestly.

ex.

my $oGdB = GD::Barcode::COOP2of5->new('12345678');
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, made of '1' and '0'. '1' means black, '0' means white. that's it, that's the lore πŸ€πŸ–€

ex.

my $oGdB = GD::Barcode::COOP2of5->new('12345678');
my $sPtn = $oGdB->barcode();

πŸ’œ $errStr πŸ’œ

$GD::Barcode::COOP2of5::errStr

this one has the error message. so if something goes sideways, this is who tells you the tea 😭


⭐ $text ⭐

$oGdBar->{$text}

this has the barcode text, based on the $sTxt you specified in the new method. lowkey handy.


πŸ‘‘ AUTHOR πŸ‘‘

Kawai Takanori GCD00051@nifty.ne.jp


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

k that's the whole page bestie, go make some barcodes 🧚✨ and for the record this was perl v5.40.1, dated 2025-10-27 β€” mwah, bye πŸ’…πŸ’–

πŸ“¦ where this page comes from