AcidHawk has asked for the wisdom of the Perl Monks concerning the following question:
The CSV file holds info on the server and what was wrong on the server as well as the call number that is associated with the event. When I have another similar event I check to see if a call already exists in the CSV file.Man;Server;Error;Instance;Instance_Detail;Status;CallNum<P>
The code I use is this.. it works but I loose about 4k for every time I query this CSV file...
$call_num = &Check_For_Call($Man,$Server,$Error,$Instance_Detail);
sub Check_For_Call { My subroutine looks like so
my ($Man,$Server,$Error,$Instance_Detail) = @_; $num = (); $dbh = DBI->connect(qq{DBI:CSV:f_dir=$xcall_path}) or die &Debug_L +og("\nDEBUG - Problems Connecting to CSV File\n"); $dbh->{'csv_tables'}->{'Exist'} = { 'file' => 'ExistCalls', 'sep_char' => ';', 'eol' => "\n"}; my($query) = "SELECT CallNum FROM Exist where Man like '$Man' and +Server like '$Server' and Error like '$Error' and Instance_Detail lik +e '$Instance_Detail'"; #&Debug_Log("SELECT CallNum FROM Exist where Man like '$Man' and S +erver like '$Server' and Error like '$Error' and Instance_Detail like + '$Instance_Detail'\n"); my($sth) = $dbh->prepare($query) or &Debug_Log("\nDEBUG - Prob +lems Preparing the SQL Statement in Check_for_Call\n"); $num = $sth->execute() or &Debug_Log("\nDEBUG - Problems Execu +ting the SQL Statement in Check_for_Call\n"); if (defined $num) { chomp($num); $sth->finish(); $dbh->disconnect(); return ($num); } else { #No Call Number Defined $sth->finish(); $dbh->disconnect(); return (2); } $sth->finish(); $dbh->disconnect(); return(1); }
If I have a return of "1" then I know that there is no call that currently exists for the event that I received. If I get a return of "2" then I know that I have received this event before but have not received the corresponding call number yet. other wise I want to return the "call number" in the CSV file.
I do get all the correct responses from the code above I just can't let the script run without stopping and starting it every so often due to the memory leak.
Any Ideas..?
Many Thanks.
-----
Of all the things I've lost in my life, its my mind I miss the most.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBD::CSV Memory Leak
by Jaap (Curate) on Aug 05, 2002 at 13:25 UTC | |
by AcidHawk (Vicar) on Aug 05, 2002 at 13:41 UTC | |
by AcidHawk (Vicar) on Aug 05, 2002 at 13:52 UTC | |
by Ovid (Cardinal) on Aug 05, 2002 at 16:41 UTC | |
|
Re: DBD::CSV Memory Leak
by tantarbobus (Hermit) on Aug 05, 2002 at 19:34 UTC | |
|
Re: DBD::CSV Memory Leak
by AcidHawk (Vicar) on Aug 05, 2002 at 14:54 UTC | |
|
Re: DBD::CSV Memory Leak
by Jaap (Curate) on Aug 05, 2002 at 14:30 UTC | |
by AcidHawk (Vicar) on Aug 06, 2002 at 06:20 UTC | |
|
Re: DBD::CSV Memory Leak
by AcidHawk (Vicar) on Aug 06, 2002 at 12:16 UTC |