On Mon, Jan 16, 2006 at 04:33:59PM -0500, David F. Skoll wrote:
> Gary Funck wrote:
>
> > This is really an academic question, but would it be possible to
> > scan/compile the mimedefang filter before including and adjust the
> > prototype declaration and use accordingly?
>
> It is possible with Perl source filters.
Nah, you don't need source filters. You can inspect a function's
prototype using the "prototype" function, after the function is
defined... something like this will probably work (UNTESTED, though)
my $filter_begin_can_handle_arg;
require $Filter;
if ( exists &filter_begin and defined(prototype(\&filter_begin))
and prototype(\&filter_begin) eq '' )
{
$filter_begin_can_handle_arg = 0;
} else {
$filter_begin_can_handle_arg = 1;
}
# ...
# call filter_begin:
$filter_begin_can_handle_arg ? filter_begin($entity) : filter_begin();
> It is not a good idea, though. Silently hiding bugs by modifying code
> at run-time should give you the heebie-jeebies...
Likewise. I'd suggest you do NOT include the above workaround :) and instead
make people adapt their own source. An example "HOWTO" would be nice,
though, for the ilperlliterate among us...
--
#!perl -wpl # mmfppfmpmmpp mmpffm <[EMAIL PROTECTED]>
$p=3-2*/[^\W\dmpf_]/i;s.[a-z]{$p}.vec($f=join('',$p-1?chr(sub{$_[0]*9+$_[1]*3+
$_[2]}->(map{/p|f/i+/f/i}split//,$&)+97):qw(m p f)[map{((ord$&)%32-1)/$_%3}(9,
3,1)]),5,1)='`'lt$&;$f.eig; # Jan-Pieter Cornet
_______________________________________________
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 [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang