Hello Perl Monks!
I am trying to write a Perl module that generates a UPCE barcode, I have the module and everything installed but when I try to test my code it prints out an error about an unblessed reference. I have never used bless, nor do I quite understand how to use it (yes I know that is bad). Here is the code that I am working with.

use GD::Barcode::UPCE; my $oGdBar = GD::Barcode->new( 'UPCE', $customer{id} ); if ( !$oGdBar ) { display_menu_error("ERROR: $GD::Barcode::errStr \n"); } print "PTN:", $oGdBar->{text}, ":", $oGdBar->{barcode}, "\n"; #FIXME Prints out an error regarding unblessed referance my $output = '/tmp/UPCE.png'; open my $OUTFILE, '>', $output; print {$OUTFILE} $oGdBar->plot->png; close {$OUTFILE}; undef $oGdBar; undef $OUTFILE; undef $output; system "lpr -r $output";

I tried to follow the example file that was included with the tarbal for the module. The $customer{id} variable contains a string in this form "000-000000".


In reply to Need some help with GD::Barcode::UPCE module by vendion

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.