<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">So this may be way more simple than I thought.<div><br></div><div>Seems that putting the contents of a directory into a file is an available tutorial, and think I understand it.</div><div><br></div><div>removing the extensions is a matter of a regex funciton, basically:</div><div><br></div><div><span class="Apple-style-span" style="font-family: Times; font-size: 16px; ">$text =~ s/\.DBS/gi;</span></div><div><font class="Apple-style-span" face="Times" size="4"><span class="Apple-style-span" style="font-size: 16px;"><br></span></font></div><div><font class="Apple-style-span" face="Times" size="4"><span class="Apple-style-span" style="font-size: 16px;">Is this correct so far/</span></font></div><div><font class="Apple-style-span" face="Times" size="4"><span class="Apple-style-span" style="font-size: 16px;"><br></span></font></div><div><font class="Apple-style-span" face="Times" size="4"><span class="Apple-style-span" style="font-size: 16px;">Thanks again,</span></font></div><div><font class="Apple-style-span" face="Times" size="4"><span class="Apple-style-span" style="font-size: 16px;"><br></span></font></div><div><font class="Apple-style-span" face="Times" size="4"><span class="Apple-style-span" style="font-size: 16px;">-B</span></font></div><div><font class="Apple-style-span" face="Times" size="4"><span class="Apple-style-span" style="font-size: 16px;"><br></span></font></div><div><div><div>On May 22, 2008, at 1:20 PM, Bill Bartilson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi All,<br><br>I'm configuring a mail server to work with a spam filter called ASSP. <br>It's written in Perl, with which I have no experience... so I have a <br>question.<br><br>The script has a call to a .db file in which folks who are authorized <br>via POP are considered authenticated senders. It's looking for IP <br>addresses only.<br><br>The mail server maintains a list of active POP connections within a <br>specific directory, not a file. Each file is the dotted decimal of <br>the active connection and the extension .dbs.<br><br>Now the question:<br><br>What's the best way to attack this? My choice would be to modify the <br>script to parse the contents of the directory instead of the looking <br>for a .db file. That is, look at the contents of the directory when <br>and only when it needs to - strip the extensions from the list of <br>files, and do it's thing. Doesn't matter to me whether the script <br>creates/modifies a .db file and the other code remains intact, or the <br>code itself is modified to work by looking at a directory and parsing <br>the contents.<br><br>The original code:<br><br>sub PopB4SMTP {<br>my $ip=shift;<br>if($PopB4SMTPMerak) {<br>return 1 if PopB4Merak($ip);<br>return 0;<br>}<br>return 0 unless $PopB4SMTPFile;<br>unless ($TriedDBFileUse) {<br>eval 'use DB_File';<br>mlog(0,"could not load module DB_File: $@") if $@;<br>$TriedDBFileUse=1;<br>}<br><br>my %hash;<br># tie %hash, 'DB_File', $PopB4SMTPFile, O_READ, 0400, $DB_HASH;<br>tie %hash, 'DB_File', $PopB4SMTPFile;<br>if($hash{$ip}) {<br>mlog(0,"PopB4SMTP OK for $ip");<br>return 1;<br>} else {<br>mlog(0,"PopB4SMTP failed for $ip");<br>return 0;<br>}<br>}<br><br><br>Suggestions?<br><br>Thanks in advance for any info.<br><br>Regards,<br>Bill<br>_______________________________________________<br>linux-user mailing list<br><a href="mailto:linux-user@egr.msu.edu">linux-user@egr.msu.edu</a><br>http://mailman.egr.msu.edu/mailman/listinfo/linux-user<br></blockquote></div><br></div></body></html>