I wrote this script in an hour or two, sorry if it's confusing or
unsightly.  Basically it will take a list of IP ranges (sample in
__DATA__) and produce procmail recipes to match the ranges.  I
couldn't use Regexp::List, which will optimize a list into a single
regular expression, because it produces Perl regular expressions which
procmail doesn't understand.  I tried to work around that but finally
gave up and wrote a limited optimizer that does numeric range for IPs
and is not very good.  It works OK for me, but I would like to know if
anyone has comments on the correctness, or wants to suggest
improvements.

Background: a user wanted a way to produce IP regexes for procmail
directly from a text list of ranges.  I wrote the script (without
-procmail it just checks the IP) but the user wanted procmail regexes
only.  Procmail regexes are pretty basic so I thought it was an
interesting problem; of course it would have been much easier if
regex matching on numbers could be done in base 16 :)

Thanks
Ted

Attachment: checkip.pl
Description: Perl program

_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to