[GLLUG] Perl script question

Bill Bartilson bbartilson at comcast.net
Thu May 22 14:39:50 EDT 2008


So this may be way more simple than I thought.

Seems that putting the contents of a directory into a file is an  
available tutorial, and think I understand it.

removing the extensions is a matter of a regex funciton, basically:

$text =~ s/\.DBS/gi;

Is this correct so far/

Thanks again,

-B

On May 22, 2008, at 1:20 PM, Bill Bartilson wrote:

> Hi All,
>
> I'm configuring a mail server to work with a spam filter called ASSP.
> It's written in Perl, with which I have no experience... so I have a
> question.
>
> The script has a call to a .db file in which folks who are authorized
> via POP are considered authenticated senders.  It's looking for IP
> addresses only.
>
> The mail server maintains a list of active POP connections within a
> specific directory, not a file.  Each file is the dotted decimal of
> the active connection and the extension .dbs.
>
> Now the question:
>
> What's the best way to attack this?  My choice would be to modify the
> script to parse the contents of the directory instead of the looking
> for a .db file.  That is, look at the contents of the directory when
> and only when it needs to - strip the extensions from the list of
> files, and do it's thing.  Doesn't matter to me whether the script
> creates/modifies a .db file and the other code remains intact, or the
> code itself is modified to work by looking at a directory and parsing
> the contents.
>
> The original code:
>
> sub PopB4SMTP {
> my $ip=shift;
> if($PopB4SMTPMerak) {
> return 1 if PopB4Merak($ip);
> return 0;
> }
> return 0 unless $PopB4SMTPFile;
> unless ($TriedDBFileUse) {
> eval 'use DB_File';
> mlog(0,"could not load module DB_File: $@") if $@;
> $TriedDBFileUse=1;
> }
>
> my %hash;
> # tie %hash, 'DB_File', $PopB4SMTPFile, O_READ, 0400, $DB_HASH;
> tie %hash, 'DB_File', $PopB4SMTPFile;
> if($hash{$ip}) {
> mlog(0,"PopB4SMTP OK for $ip");
> return 1;
> } else {
> mlog(0,"PopB4SMTP failed for $ip");
> return 0;
> }
> }
>
>
> Suggestions?
>
> Thanks in advance for any info.
>
> Regards,
> Bill
> _______________________________________________
> linux-user mailing list
> linux-user at egr.msu.edu
> http://mailman.egr.msu.edu/mailman/listinfo/linux-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.egr.msu.edu/mailman/public/linux-user/attachments/20080522/dc7eb742/attachment.html 


More information about the linux-user mailing list