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

Greetings, brothers.

Here goes my stats:

I'm using Windows 98SE, ActiveState's Perl 5.6.1 Build 631, DBI/DBD::ODBC, Xitami Webserver 2.4d9 and a Microsoft Access 2000 Database.

When I run a particular script it causes Perl to crash, generating the following Windows error (translated, since I'm not american):
PERL caused an invalid page flaw at module <unknown> in 0000:1f8fdff2. Records: EAX=01cd0094 CS=015f EIP=1f8fdff2 EFLGS=00010202 EBX=01cd0314 SS=0167 ESP=0153f89c EBP=0153f8bc ECX=00000000 DS=0167 ESI=01cd0a90 FS=3f77 EDX=8175814c ES=0167 EDI=00000001 GS=0000 Bytes in CS:EIP:
Here's the piece of code that's causing it:
if (param('action') eq "cli_definido") { #$dt_prosp = ""; $ger = ""; $cliente = param('n_cliente'); #@t=(localtime)[0..5]; #$dt_prosp=sprintf "%02u/%02u/%02u %02u:%02u:%02u",$t[3],$t[4] ++1,$t[5]+1900,$t[2],$t[1],$t[0]; $dbh = SysUtils::Connect; $sth2 = $dbh->prepare_cached("SELECT nome FROM usuarios WHERE +login='$login'"); $sth2->execute; while (@data = $sth2->fetchrow_array) { $nome_gerente = $data[0]; } $ger = "<span class=\"texto2\">$nome_gerente</span><input type +=\"hidden\" name=\"gerente\" value=\"$login\">"; $sth2->finish; $neg = "<select name=\"n_negocio\">\n<option value=\"null\" SE +LECTED>Selecione:</option>\n"; $sth3 = $dbh->prepare_cached("SELECT oportunidade, status FROM + oportunidades WHERE razao_social='$cliente' AND status NOT IN ('F',' +L')"); $sth3->execute; while (@data = $sth3->fetchrow_array) { $neg .= "<option value=\"$data[0]\">$data[0]</option>\n"; $def_status = $data[1]; } $neg .= "</select>"; $sth3->finish; $slct_status = "<select name=\"n_status\">"; $sth4 = $dbh->prepare_cached("SELECT cd_status, status FROM st +atus ORDER BY cd_status"); $sth4->execute; while (@data = $sth4->fetchrow_array) { $pos_status = $data[0]; if ($pos_status eq $def_status) { $slct_status .= "<option value=\"$pos_status\" SELECTE +D>$data[1]</option>\n"; } else { $slct_status .="<option value=\"pos_status\">$data[1]< +/option>\n"; } } $slct_status .= "</select>\n"; $sth4->finish; $n_cliente = param('n_cliente'); $cli = "<span class=\"texto2\">$n_cliente</span><input type=\" +hidden\" name=\"n_cliente\" value=\"$n_cliente\"><input type=\"hidden +\" name=\"action\" value=\"go\">"; $dbh->disconnect; print "Content-type: text/html\r\n\r\n"; open (FH,"templates/cadastro_proposta.htm") or die "Cant open +body: $!"; $body = join('',<FH>); close (FH); eval "\$body = sprintf \"%s\",<<FYNYS;\n $body\nFYNYS\n"; print $body; }
Any possibilities?

I'm really desperate here...

Thanks in advance,

Er Galvão Abbott
a.k.a. Lobo, DaWolf
Webdeveloper


PS1: I know that I should use strict. Please be kind to not flame me on this right now. I need help.

PS2: I used <code>-w<code> and all I got were the original "non-fatal" warnings - like possible typos and stuff.

PS3: PLEASE HELP ME.

Replies are listed 'Best First'.
Re: ActivePerl is crashing when running a script!
by jepri (Parson) on Mar 20, 2002 at 05:45 UTC
    You are going to have to do a bit more work to get at the problem. First, unbuffer the output with $|++, then start printing out loads of statements like "I'm here!" and "still going!". Turn up logging on the data base and see if your program manages to complete all it's calls.

    Finally, I'm going to take a wild guess and suggest you rewrite this line:

    $neg .= "<option value=\"$data[0]\">$data[0]</option>\n";

    For no other reason than once, long ago, I had a perl script crashing out on concatenations when working through a lot of data. Try pushing the strings onto an array like push @neg, "<option..." and then joining the array afterwards. But that's pure speculation, and I would first blame the database since MS bashing is fun. But if it is the database there's nothing you can do.

    ____________________
    Jeremy
    I didn't believe in evil until I dated it.

Re: ActivePerl is crashing when running a script!
by tachyon (Chancellor) on Mar 20, 2002 at 11:41 UTC

    I have had this problem on Win98SE when Norton Antivirus 2000 is running. If NAV2000 is running scripts crash with page faults. If NAV2000 is not running everything works fine. Kill you anti-virus software and see if it still page faults. If that does not fix the problem shut down all the running processes that you can and see if it fixes the problem.

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Re: ActivePerl is crashing when running a script!
by jepri (Parson) on Mar 20, 2002 at 05:52 UTC
    Update: I think I've found your problem: I'm using Windows 98SE, ActiveState's Perl 5.6.1 Build 631, DBI/DBD::ODBC, Xitami Webserver 2.4d9 and a Microsoft Access 2000 Database.

    Don't use any of the Win9x product line for anything more than playing games. I'm not kidding. Why did MS release a server edition, known as NT? Because 95, 98 and Me are flashy, trashy games systems. If you don't believe me, ring your local MS rep and ask him. i'm sure he'll be happy to come around and "help" your boss to decide to upgrade to NT/2k.

    Note: Update in separate post because the retard running our proxy server doesn't realise you can't cache POSTs. I guess here's nothing in his MCSE manuals about it. Heh.____________________
    Jeremy
    I didn't believe in evil until I dated it.

      Thanks, man.

      I do realize this. On the company they run Windows 2000 Professional, so I'll test it there tomorrow. The problem is if it doesn't works there I'm really screwed...

      Thanks a lot for your effort anyway. :-)

      Er Galvão Abbott
      a.k.a. Lobo, DaWolf
      Webdeveloper
      More than that MS Access is a trashy excuse for a database system.

      I once worked for a company that wanted this same set up. Access worked fine on small simple scripts but even making the scripts longer it began to have problems. We finally gave up because it simply never worked correctly.
Re: ActivePerl is crashing when running a script!
by rdfield (Priest) on Mar 20, 2002 at 10:30 UTC
    You might want to check the value of $dbh->errstr after each use of connect, prepare and execute. It's happened to me on more than one occation on Win9x that an SQL error will cause a crash if you try and use an invalid(ated) handle.

    rdfield

Re: ActivePerl is crashing when running a script!
by rinceWind (Monsignor) on Mar 20, 2002 at 11:29 UTC
    DaWolf, have you tried debugging said script.

    I have found Devel::ptkdb invaluable for debugging CGI scripts. You just need to change the shebang line to #!/usr.../perl -d:ptkdb and you're away.

    That way, you should be able to see exactly where it is crashing.

    see Devel::ptkdb.

    --rW

Re: ActivePerl is crashing when running a script!
by DaWolf (Curate) on Mar 20, 2002 at 14:35 UTC
    What's up, fellow monks.

    The problem after all was Win9x. I've tested in the company I'm working with Win2000 Professional and it worked just fine.

    I'm not using NAV at home, althrough I'm using AVG... I'll try later to test it without the AVG running.

    Thanks a lot for your help.

    You guys have been great as usual.

    Best regards,

    Er Galvão Abbott
    a.k.a. Lobo, DaWolf
    Webdeveloper