This whole code is inside a loop. I don't think the constant opening and closing of the database is the problem (although it slows the program down), but I could be wrong. Thanks for any help!use Win32::OLE; use Win32::OLE::Const 'Microsoft ActiveX Data Objects'; sub extractEmail { my($hitPage) = @_; my $email; my $emailPresent = 0; my $webTitle = HTML::TokeParser->new($hitPage); my $titlePage = ""; my $Conn = Win32::OLE->new("ADODB.Connection"); my $RecSet = Win32::OLE->new("ADODB.Recordset"); my $DBTable = "Addresses"; my $DBFile = "g:\\PO system\\emailaddresses.mdb"; my $DSN = "PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb +)};DBQ=$DBFile"; #Opens the connection to the database $Conn->Open($DSN); $RecSet->Open($DBTable, $Conn,adLockOptimistic, adOpenDynamic); + #The current page is searched for any <MAILTO:> tags and extracts +email addresses and stores them in a database and file while($$hitPage =~ /mailto:.*?\.(com|ca|net)/g) { $email = $&; $email =~ s/mailto://g; $titlePage = $webTitle->get_trimmed_text("/title"); print OUTFILE $email, "\t\t", $webTitle->get_trimmed_text("/title" +); $RecSet->AddNew(["Email Address", "Website Title"], [$email, $titl +ePage]); $emailPresent = 1; } $RecSet->Close(); $Conn->Close(); return $emailPresent; }
In reply to Adding data to an access database by Raziel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |