Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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.

Comment on barcode renders from script, but not executable
Select or Download Code
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (13)
As of 2015-10-06 17:42 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (156 votes), past polls