On Tue, Apr 13, 2004 at 02:53:35PM -0400, Theo Van Dinter wrote: > the exact same issue you're talking about. My initial reaction is to > cheat and save off a copy of the scores arrays in the daemon, and copy it > into place per user switch, but that's not the right way to do it (tm). :(
Turns out that doesn't really solve the problem anyway...
Been looking at things a little more: read_scoreonly_config() does
more than scores... it's scores, whitelists, blacklists, version tags,
required_hits, rewrite_header, etc. Basically anything the users are
allowed to change.
So there are two options that I can see:
1) kill $M::SA->{conf}, and re-init ala:
$m = new Mail::SpamAssassin(...);
... do stuff ...
$m->{conf} = new Mail::SpamAssassin::Conf ($m);
$m->read_scoreonly_config(...);
This would solve the problem completely, but would cause each message
to load all of the configs, which kills most of the benefits of running
in a daemon in the first place.
2) somehow make a complete duplicate of $m->{conf} values. something
like:
$m = new Mail::SpamAssassin(...);
$conf = $m->backup_config();
... do stuff ...
$m->restore_config($conf);
$m->read_scoreonly_config(...);
where backup_config and restore_config would do a complete recursive copy
of the object's variables. it needs to be completely recursive since
things like the scores array is really an array of hash references,
and we need to dereference everything.
Doing a little research, looks like Storable::freeze()/thaw() might make
a good backup/restore utility, but I'll have to look into it some more.
--
Randomly Generated Tagline:
And shun the frumious Bandersnatch.
pgpMsFzHZCz2y.pgp
Description: PGP signature
