in reply to Re: Need some help with GD::Barcode::UPCE module
in thread Need some help with GD::Barcode::UPCE module

I couldn't replicate your error. As for $oGdBar->{text}, that is the correct way to do it. Try this and see if it helps:
#!/usr/bin/perl use strict; use warnings; use GD::Barcode::Code39; my $oGdBar = GD::Barcode->new( 'Code39', '*123-456789*' ); print "PTN:", $oGdBar->{text}, ':', $oGdBar->barcode(), "\n"; open OUT, '>', '/tmp/Code39.png'; binmode OUT; print OUT $oGdBar->plot->png; close OUT; undef $oGdBar;

Replies are listed 'Best First'.
Re^3: Need some help with GD::Barcode::UPCE module
by vendion (Scribe) on Oct 11, 2010 at 18:56 UTC

    Even after changing my $oGdBar = GD::Barcode::Code39->new() to my $oGdBar = GD::Barcode->new() I still get the same error. I checked to make sure my GD::Barcode module is current and CPAN says I have version 1.15 installed

      You still get the same error because you're still making the same mistake:). You'll need to change more than just new(). Post what you have now, then we can figure out what's wrong.

        Ok well there is what I have currently

        #!/usr/bin/perl use strict; use warnings; use GD::Barcode::Code39; my $oGdBar = GD::Barcode->new('Code39', "*$customer{id}*"); #my $oGdBar = GD::Barcode::Code39->new("*$customer{id}*"); if ( !$oGdBar ) { display_menu_error("ERROR: $GD::Barcode::Code39::errStr \n"); } print "PTN:", $oGdBar->{text}, ":", $oGdBar->barcode(), "\n"; #FIXME prints out error "Can't locate object method "Small" via packag +e "GD::Font" (perhaps you forgot #to load "GD::Font"?) at /usr/local/share/perl5/GD/Barcode/Code39.pm l +ine 111, <> line 19." my $output = '/tmp/Code39.png'; open my $OUTFILE, '>', $output; binmode $OUTFILE; print {$OUTFILE} $oGdBar->plot->png; close {$OUTFILE}; undef $oGdBar; undef $OUTFILE; undef $output; system "lpr -r $output";

        Not sure what mistake it is I am making here, I thought I followed the documentation to the letter. Ether way the barcode is being generated I can tell this because of the output from $oGdBar->barcode(), but the /tmp/Code39.png file is empty.