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 associated Barcode::ZBar::Processor object and the closure as arguments. You can do the closure thing the standard Perl way, or just manually pass a scalar via closure. 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 of Barcode::ZBar::Symbol results 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 a Barcode::ZBar::Image for 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 for zbarcam / 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 before init() β€” 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 (0 for all) to the specified value. @returns 0 for success, non-0 for failure (which happens if the config doesn't apply to the specified symbology, or the value is out of range). πŸ’œ

πŸ¦‹ SEE ALSO πŸ¦‹


πŸ’Œ AUTHOR πŸ’Œ

Jeff Brown, <spadix@users.sourceforge.net>


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