Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

barcode renders from script, but not executable

by cloned (Novice)
on Nov 30, 2011 at 22:35 UTC ( #940956=perlquestion: print w/replies, xml ) Need Help??
cloned has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, I'm using GD::Barcode::QRcode to render QR codes. Works great with perl, but when I make the perl script into an executable with perlapp the data does not render into the graphic. It creates a QR code, but it is the the bare QR code, not data. Here is the code

use GD::Barcode::QRcode; my $message = "help me perl monks"; my $barcode = GD::Barcode::QRcode->new( $message, { Ecc => 'L', Version=>6, ModuleSize => 2})- +>plot->png; my $file = 'QR_Code.png'; open($fh,">", $file) || die; binmode($fh); print $fh $barcode; close $fh;

here is the perlapp command:

perlapp --norunlib --xclude --nocompress --verbose --warnings --force --exe generate_qr_x.exe --perl C:\Perl64\bin\perl.exe

Any thoughts? Thanks.

Replies are listed 'Best First'.
Re: barcode renders from script, but not executable
by Khen1950fx (Canon) on Dec 01, 2011 at 02:05 UTC
    I'm not quite sure what you mean by "bare code"; however, I think that you were missing a few critical parts. Try this:
    #!/usr/bin/perl use strict; use warnings; use GD::Barcode::QRcode; my $oGdBar = GD::Barcode::QRcode->new( 'QRcode', { Ecc => 'M', Version => 6, ModuleSize => 2, } ); print "PTN:", $oGdBar->{text}, ":", $oGdBar->barcode, "\n"; open OUT, '>', 'QRcode.png' or die $!; binmode OUT; print OUT $oGdBar->plot->png; close OUT; open OUT, '>', 'QRcode.txt'; print OUT $oGdBar->barcode(); close OUT; undef $oGdBar;

      copy and pasted your code. Works perfectly as a perl script, same as mine. But, when I make it an executable with perlapp it will only render a blank (bare) QR code. So making it an executable breaks the rendering of the actual barcode data. If I knew how to upload a .png I could show you what I mean.

Re: barcode renders from script, but not executable
by TJPride (Pilgrim) on Dec 01, 2011 at 01:49 UTC
    Is there a particular reason why it has to be compiled in the first place?

      It needs to run on a machine that will not have perl on it.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://940956]
Approved by marto
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2017-12-14 03:47 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (384 votes). Check out past polls.