OK, so I had CueCat installed (this barcode reader + software you can get
at Radio Shack etc.), and the software seemed like it might be acting up,
and I wasn't using it, so I disconnected it.

I am cleaning my office today, and so I just scan something with a text
window open, and I notice that the data is going right to my screen!

So I remember someone wrote a little Perl module to deal with CueCat data,
and I run it, and it works.  No software needed at all (except for Perl,
but no special drivers or anything).

Here's the script:

        #!perl -w
        use Barcode::Cuecat;  # need to "hack" module to work with MacPerl

        my $continuous = 1;
        my $bc = new Barcode::Cuecat;

        print "Type 'q' to quit.\n" if $continuous;

        while (chomp(my $data = <STDIN>)) {
          last if $data eq 'q';

          $bc->scan($data);
          printf "%s: %s\n", $bc->type, $bc->code;

          last unless $continuous;
        }

And here is the output:

        Type 'q' to quit.
        .C3nZC3nZC3n2D3bWDhvZDxnY.fHmc.Dxr1DxfWC3D3END2.
        UPA: 676623044945
        .C3nZC3nZC3n2D3bWDhvZDxnY.cGen.ENr7CNT1CNnZD3D6EG.
        IBN: 9781861004499
        .C3nZC3nZC3n2D3bWDhvZDxnY.fHmc.C3b3Dhn0C3bYDNvX.
        UPA: 034707031562
        q

The lines starting with ".C3" consists of the actual data the scanner reads
in.  The first scan is the UPA (UPC?) symbol from a book.  The next one is
the ISBN.  The third is the UPA symbol from a CD-R case.  This is too cool.
If I had realized it just sent data to STDIN like the keyboard, I would
have done this long ago.

The "hack" to get the module to run is to remove the our(), use warnings,
and require 5.005 lines.  Replace the "our" line with
"$Barcode::CueCat::VERSION" or whatever, if you like.

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Development Network    [EMAIL PROTECTED]     http://osdn.com/

Reply via email to