Re: [Mimedefang] Wiki updates

2006-04-07 Thread Philip Prindeville
[EMAIL PROTECTED] wrote:

>>Anyone else have any comments about the example or the strategy?
>>
>>
>
>Very nice.
>  
>

If anyone ends up using it, and/or making improvements on it, please report
your experience to me or the list.  Thanks.

___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


RE: [Mimedefang] Wiki updates

2006-04-06 Thread Matthew.van.Eerde
Philip Prindeville wrote:
> Anyone else have any comments about the example or the strategy?

Very nice.

-- 
Matthew.van.Eerde (at) hbinc.com   805.964.4554 x902
Hispanic Business Inc./HireDiversity.com   Software Engineer

___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


Re: [Mimedefang] Wiki updates

2006-04-06 Thread Philip Prindeville
Steffen Kaiser wrote:

>You match the TLD agains $ccpat.
>
>BTW: I don't remember where, but there is perl FAQ with entry like "how 
>can I check if a value is part of an ARRAY?", the answer is like "if you 
>need to ask this, you certainly have used the wrong data structure and 
>should use an HASH. Otherwise use foreach()".
>I'd say you should do the same and use HASHes instead of ARRAY and regex.
>
>Bye,
>  
>

Ok, it's been tweaked.

I've changed @bad_countries to a hash, and I've changed @bad_tld's into
a hash
as well (I probe it with the RHS of the hostname from longest to
shortest, stripping
off the left-most component until there's only one component left).

Anyone else have any comments about the example or the strategy?

-Philip



___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


Re: [Mimedefang] Wiki updates

2006-04-06 Thread Philip Prindeville
Steffen Kaiser wrote:

>On Wed, 5 Apr 2006, Philip Prindeville wrote:
>
>  
>
>>I added a new example to the Wiki that people can download and paste
>>in if they wish:
>>
>>http://www.mimedefang.org/kwiki/index.cgi?PhilipsWorkingFilter
>>
>>Any comments are appreciated.
>>
>>
>
>:-) You ban the .eu TLD (European Union) even before the registration 
>began:
>"Monday, April 3, 2006
>
>.EU Registrations Begin This Friday!
>Public registrations of .EU begin this Friday at 2:00 a.m. (Pacific
>Daylight Time)"
>  
>

That's because it's not an enforceable legal authority. You still need to
rely on the transparency of the member countries to enforce anti-spam
policy, pursue fraud, misrepresentation, extortion, etc.


>You match the TLD agains $ccpat.
>  
>

That's right: just in case the IP address doesn't match in IP::Country
but the rDNS contains a country-code TLD (i.e. .mx).

>BTW: I don't remember where, but there is perl FAQ with entry like "how 
>can I check if a value is part of an ARRAY?", the answer is like "if you 
>need to ask this, you certainly have used the wrong data structure and 
>should use an HASH. Otherwise use foreach()".
>I'd say you should do the same and use HASHes instead of ARRAY and regex.
>  
>

The problem is that when matching against @bad_tlds you're don't know in
advance how many domain components to strip off and test... It could be an
arbitrary number.

So I'm taking a substring of the right-hand side of $hostname and
looking for
it in @bad_tlds, but I don't know in advance how long a portion of it...

-Philip

>Bye,
>
>  
>

___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


RE: [Mimedefang] Wiki updates

2006-04-06 Thread Steffen Kaiser

On Thu, 6 Apr 2006, [EMAIL PROTECTED] wrote:


Steffen Kaiser wrote:

BTW: I don't remember where, but there is perl FAQ with entry like
"how can I check if a value is part of an ARRAY?", the answer is like
"if you need to ask this, you certainly have used the wrong data
structure and should use an HASH. Otherwise use foreach()".
I'd say you should do the same and use HASHes instead of ARRAY and
regex.


Something like

my %bad_countries_hash = map { $_ => 1 } @bad_countries;


or

my %bad_countries = map { $_ => 1 } (

qw( ... )

);

In order to avoid the conversation each time the function is called.

Bye,

--
Steffen Kaiser
___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


RE: [Mimedefang] Wiki updates

2006-04-06 Thread Matthew.van.Eerde
Steffen Kaiser wrote:
> BTW: I don't remember where, but there is perl FAQ with entry like
> "how can I check if a value is part of an ARRAY?", the answer is like
> "if you need to ask this, you certainly have used the wrong data
> structure and should use an HASH. Otherwise use foreach()".
> I'd say you should do the same and use HASHes instead of ARRAY and
> regex. 

Something like

my %bad_countries_hash = map { $_ => 1 } @bad_countries;

...

if ($bad_countries_hash{$cc}) { ... }

___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


Re: [Mimedefang] Wiki updates

2006-04-06 Thread Steffen Kaiser

On Wed, 5 Apr 2006, Philip Prindeville wrote:


I added a new example to the Wiki that people can download and paste
in if they wish:

http://www.mimedefang.org/kwiki/index.cgi?PhilipsWorkingFilter

Any comments are appreciated.


:-) You ban the .eu TLD (European Union) even before the registration 
began:

"Monday, April 3, 2006

.EU Registrations Begin This Friday!
Public registrations of .EU begin this Friday at 2:00 a.m. (Pacific
Daylight Time)"

You match the TLD agains $ccpat.

BTW: I don't remember where, but there is perl FAQ with entry like "how 
can I check if a value is part of an ARRAY?", the answer is like "if you 
need to ask this, you certainly have used the wrong data structure and 
should use an HASH. Otherwise use foreach()".

I'd say you should do the same and use HASHes instead of ARRAY and regex.

Bye,

--
Steffen Kaiser
___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang