Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

perlapp not compiling properly

by fmogavero (Monk)
on Jun 06, 2001 at 20:06 UTC ( [id://86284]=perlquestion: print w/replies, xml ) Need Help??

fmogavero has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to compile using the line
perlapp -c -v -r -s=dupes.pl -f -e=fixdupes.exe

when I run the .exe, it does not perform the same as the dupes.pl file.

the script goes into the database, finds duplicate entries, deletes them and then reorders the sequence number. The dbconnection.pm is an object used to return a dbhandle to the script. the three @ARGV[] elements are the database, username and password.

use dbconnection; use strict; open ERRFILE, ">>c:\\dupeerr.txt"; print @ARGV[0],"\n"; print @ARGV[1],"\n"; print @ARGV[2],"\n"; my @tsid; my $dupecount; my @temparray = (); my $connection = new Dbconnection(@ARGV[0], @ARGV[1], @ARGV[2]); my $sth = $connection->connection->prepare("select travelersystemid, remarktypecd, min(remarkseqnbr),remarktext from remarks group by travelersystemid, remarktypecd, remarktext having count(*) > 1 order b +y travelersystemid, remarktypecd, remarktext")or die print ERRFILE $!; my $rc = $sth->execute or die print ERRFILE $!; while ( my $row = $sth->fetchrow_arrayref){ push @temparray, @{$row}; push @tsid, @{$row}[0]; } $dupecount = scalar @tsid; print "Found $dupecount sets of duplicate records.\n"; print ERRFILE "Found $dupecount sets of duplicate records.\n"; for ( my $i=0; $i < scalar @temparray; $i += 4 ) { $sth = $connection->connection->prepare('delete from remarks where travelersystemid = CONVERT(int,?) and remarktypecd = ? and remarktext = ? and remarkseqnbr > CONVERT(int,?)') or die prin +t ERRFILE $!; $sth->bind_param(1, @temparray[$i]); $sth->bind_param(2, @temparray[$i+1]); $sth->bind_param(3, @temparray[$i+3]); $sth->bind_param(4, @temparray[$i+2]); my $rc = $sth->execute or die print ERRFILE $!; } foreach my $item(@tsid){ my $type = undef; #reset var +iable my $seqcount = 1; #reset var +iable @temparray = (); #reset arr +ay $sth = $connection->connection->prepare("select travelersystemid, remarktypecd, remarkseqnbr, remarktext from rema +rks where travelersystemid = CONVERT(int, ?) order by remarktypecd, remarkseqnbr") or die print ERRFILE $!; #get query $sth->bind_param(1, $item); #bind placeholde +r my $rc = $sth->execute or die print ERRFILE $!; #execute q +uery while ( my $row = $sth->fetchrow_arrayref){ push @temparray, @{$row}; } $type = @temparray[1]; my $i; for ( $i = 0; $i < scalar @temparray; $i += 4 ) { if ( $type ne @temparray[$i+1] ) { $seqcount = 1; $type = @temparray[$i+1] } if ( $seqcount != @temparray[$i+2] ) { $sth = $connection->connection->prepare(" update remar +ks set remarkseqnbr = CONVERT(int,?) where travelersystem +id = CONVERT(int, ?) and remarktypecd = ? and remarktext = +? and remarkseqnbr = CONVERT(int, ?)") or die print ERRF +ILE $!; $sth->bind_param(1, $seqcount); $sth->bind_param(2, @temparray[$i]); $sth->bind_param(3, @temparray[$i+1]); $sth->bind_param(4, @temparray[$i+3]); $sth->bind_param(5, @temparray[$i+2]); my $rc = $sth->execute or die print ERRFILE $!; } $seqcount++; } } $connection->logout; close ERRFILE;

Does anyone have any experience with compiling using perlapp and can you explain why it runs as a .pl but not an .exe?

Replies are listed 'Best First'.
Re: perlapp not compiling properly
by Jouke (Curate) on Jun 06, 2001 at 20:36 UTC
    You say that the .pl and the .exe don't perform the same, and at the end of your node you say it runs as .pl but not as an .exe. Maybe you should tell more about the differences, so we can try to analyze better what is going on.
    As far as I see it now, there's no reason why it should run differently. Someone compiled pVoice for me with IndigoStar's Perl2Exe and it runs exactly like the .pl version, so it should be possible so make a normal running .exe file.

    Jouke Visser, Perl 'Adept'
    Using Perl to help the disabled: pVoice and pStory
      I am going to try IndigoStar's program and see how it works.
Re: perlapp not compiling properly
by wardk (Deacon) on Jun 06, 2001 at 20:58 UTC

    having no fear of asking potentially boneheaded questions, is there any compelling reason that you need the functioning .pl file to be an .exe?

    answering self....is it destined for a box "without perl"?

    merlyn spoke to this issue recently (exe's), I'll be damded if I can locate that node though.

      Yes. I have a DBA who wants to run the program on each server individually.
Re: perlapp not compiling properly
by Anonymous Monk on Jun 06, 2001 at 20:50 UTC
    You don't compile dbconnection.pm! There is no automatic .
Answer to perlapp not compiling properly
by fmogavero (Monk) on Jun 06, 2001 at 23:37 UTC
    The -x switch in the command line will exclude the perl56.dll

    This solved the problem. My guess is that since the separate memory spaces on NT for console windows are indeed separate the dll does not load unless invoked by perl.exe

    -x will compile the dll into the .exe

Re: perlapp not compiling properly
by fmogavero (Monk) on Jun 08, 2001 at 01:22 UTC
    I added  -a dbi::dbd;dbd::odbc and it works perfectly.

    What have I learned? Cranial-Rectal insertion is more common than I'd like it to be. Even though the documentation says modules will not be added in require lines if the module name is in a variable, it doesn't say that if you just plug in the name of a module, <code>DBI->connect("dbi:odbc:".$server, $username, $password), it won't search it out to include it even though you have invoked it.

    Go Figure!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://86284]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-03-29 12:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found