ZBar::Processor(3pm)
π ZBar::Processor β the manual page, but make it slay π
okay bestie, so this is ZBar::Processor(3pm), straight out of the User Contributed Perl Documentation section. It's giving "I just want to read barcodes and I want it to be easy." Let's go π¦
β¨ NAME β¨
Barcode::ZBar::Processor β a whole self-contained bar code reader, no cap. She scans, she previews, she does the most. π
πΈ SYNOPSIS πΈ
setting it up first, bestie:
use Barcode::ZBar;
my $reader = Barcode::ZBar::Processor->new();
$reader->init("/dev/video1", 1);
$reader->parse_config('code39.disable');
$reader->set_data_handler(\&my_handler);
now scanning an image:
$reader->process_image($image);
and now scanning from video:
$reader->set_visible();
$reader->set_active();
$reader->user_wait();
see? literally three lines. main character energy fr fr π₯
π DESCRIPTION π
A Barcode::ZBar::Processor is your little shortcut to making a stand-alone bar code scanning app. It has interfaces so you can scan images or video, and optionally show a video/image preview in a window. Obsessed. β¨
β οΈ but listen β this interface is not well suited for integrating with an existing GUI. Why? Because the library is the one managing the optional preview window and any user interaction. She's a solo act, she doesn't share the stage.
If that's what you need, use a Barcode::ZBar::ImageScanner instead, or go investigate the available widget interfaces for GUI applications. iykyk π«Ά
π₯ REFERENCE π₯
Methods
new()β creates you a shiny new bar code reader instance. fresh out the box, ready to go πinit([video_device], [enable_display])β opens a video input device and/or gets everything ready to display output. Both args are optional, choose your adventure.set_data_handler([handler], [closure])β sets up a callback so your results get processed whenever new results show up from the video stream or from a static image. The callable you pass gets invoked with the associatedBarcode::ZBar::Processorobject and the closure as arguments. You can do the closure thing the standard Perl way, or just manually pass a scalar viaclosure. Either way, she's got you. π§is_visible(),set_visible([visible])β test it / set it: visibility of the output window. peekaboo πΈset_active([active])β turns video streaming and bar code scanning on/off. the power switch of it all βget_results()β returns a list ofBarcode::ZBar::Symbolresults from the last scanned image or video frame. your receipts, bestie π§Ύuser_wait([timeout])β waits for the user to press a key/button or close the window. and no, it's not slacking β bar codes keep getting processed while video is active. multitasking queen πprocess_one([timeout])β enables video and scans until at least one barcode is found. heads up though: multiple results may still be returned. she's generous like that πprocess_image([image])β scans aBarcode::ZBar::Imagefor bar codes. one image, in and out.parse_config(configstr)β applies a decoder configuration setting. Wanna know which configuration options exist? Go read the docs forzbarcam/zbarimg, they've got the full menu. πrequest_size(width, height)β requests a preferred size for the video image from the device. real talk: the request may be adjusted or completely ignored by the driver. also, it must be called beforeinit()β timing is everything, bestie β°force_format(input, output)β forces specific input and output formats, for debug/testing purposes. π§set_config(symbology, config, value)β sets config for the indicated symbology (0for all) to the specified value.@returns0for success, non-0for failure (which happens if the config doesn't apply to the specified symbology, or the value is out of range). π
π¦ SEE ALSO π¦
Barcode::ZBar,Barcode::ZBar::Image,Barcode::ZBar::ImageScannerzbarimg(1),zbarcam(1)- http://zbar.sf.net
π AUTHOR π
Jeff Brown, <spadix@users.sourceforge.net>
π COPYRIGHT AND LICENSE π
Copyright 2008-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
The ZBar Bar Code Reader is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
and that's the whole page, bestie!! this one shipped as perl v5.40.1, dated 2025-05-01, under the name ZBar::Processor(3pm). go scan something iconic, ily, bye π β¨π«Ά
π¦ where this page comes from
- debian trixie: libbarcode-zbar-perl 0.23.93-8
- ubuntu questing: libbarcode-zbar-perl 0.23.93-8
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms