Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Par::Packer MySQL Select query returns 0 records

by intermediary (Initiate)
on Apr 21, 2014 at 17:25 UTC ( #1083050=perlquestion: print w/replies, xml ) Need Help??
intermediary has asked for the wisdom of the Perl Monks concerning the following question:

Hi, first time user, long time listener. Came across Par::Packer today and have been testing it to see if we can use it to hide our code in a commercial app. I have read several posts that frown upon this type of use, but that's our aim in any case. We managed to compile a seciprt which uses the depracted Mysql Perl Module, and requires several other scripts, and managed to execute it with some results. The problem we're having is this : When run as a regular script, the following code correctly returns 1 row :
$VAR{q} = qq~SELECT * FROM table~; $VAR{x} = $DBCONN->query($VAR{q}); $VAR{n} = $VAR{x}->numrows;
However, as the exe, it always returns 0. What's baffling is that the following code returns 1 record in both versions :
$VAR{q} = qq~SELECT COUNT(*) FROM table~; $VAR{x} = $DBCONN->query($VAR{q}); $VAR{n} = $VAR{x}->numrows;
Could it be some sort of Mysql privilege problem? I search high and low in google, and only found one case of a similar problem, but no solution, here :;guest=
With any luck, there'll be more potential solutions, than negative comments, provided here. What else could the problem be?
========================================== Update ==========================================
Connecting to the wrong database :)

Replies are listed 'Best First'.
Re: Par::Packer MySQL Select query returns 0 records # hiding proprietary code
by ww (Bishop) on Apr 21, 2014 at 23:51 UTC

    semi-OT, but re "to see if we can use it to hide our code in a commercial app," NO. It takes no more than a quick Super Search here, or applying your favorite search engine to this site for terms like Par::Packer and "hide" to find dozens of reasons that trying to hide your code that way is not only hopeless, but also a hopelessly wasteful use of your time.

    Questions containing the words "doesn't work" (or their moral equivalent) will usually get a downvote from me unless accompanied by:
    1. code
    2. verbatim error and/or warning messages
    3. a coherent explanation of what "doesn't work actually means.

    check Ln42!

      To reenforce this idea, understand what Par::Packer does: It effectively makes a compressed executable that when run unpacks everything into the system's temp folder and executes your script with the packed in version of perl and all of the dependencies. Finding what's in your script is trivial for anyone remotely familiar with the OS that the pp executable is being run on.

      Also, like I said above, it's a compressed executable. Unpacking the pp executable is trivial. 7zip handles it on Win32, and while I'm not entirely clear as to what does it in other places, it wouldn't be hard to figure it out.

Re: Par::Packer MySQL Select query returns 0 records
by Anonymous Monk on Apr 21, 2014 at 19:02 UTC
    turn all relevant debugging/tracing levels and crank them up

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (12)
As of 2017-03-24 17:05 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (305 votes). Check out past polls.