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?