Stefano, > Hello *, > in my @score_sender_maps I have: > > @score_sender_maps = ({ > '.' => [ > read_hash("/var/amavis/maps/sender_scores_sitewide") > ] > }); > > and it's ok for sitewide sender score. > > Is it possible to load a "full" @score_sender_maps, with domain > separation, from one (or a set of) files? > In other words I would like to dynamically load something like > @score_sender_maps = ( { > 'domain1.net' => [ read_hash("/var/amavis/maps/sender_scores_domain1") ], > 'domain2.net' => [ read_hash("/var/amavis/maps/sender_scores_domain2") ], > ... > }); > without having prior knowledge of domains to "use".
There is no ready-made input code to accept two-level lookup tables. But once you know the format of your input file you can build your own parsing code and construct a required hash of hashes. > alternatively, can I use something like > > $domain_score_folder_list=`cd /var/amavis/maps/sender_scores_by_domain ; > ls`; @domain_score_files = split(/\n/, $domain_score_folder_list); > foreach $dom_file (@domain_score_files){ > $score_sender_maps{$dom_file} => [ > read_hash("/var/amavis/maps/sender_scores_by_domain/$dom_file") ]; > } Yes, that's one way of doing it. > otherwise, is there any better solution? The code in read_hash() is probably overly complicated for most uses (it tries to deal with tricky comments and '#' characters in the middle of a localpart in the mail address). Stripping this out, what remains is very straightforward: read a line, split to left and right part, and store into a hash. There is no need to call the existing read_hash to construct a hash, just do your own parsing and build inner (by-sender) hashes and store them into the outer (by-recipient) hash. Mark ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ AMaViS-user mailing list AMaViS-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amavis-user Please visit http://www.ijs.si/software/amavisd/ regularly For administrativa requests please send email to rainer at openantivirus dot org