1 ##---------------------------------------------------------------------------##
3 ## $Id: ListDef.pm,v 1.5 2003/07/16 00:49:58 ehood Exp $
5 ##---------------------------------------------------------------------------##
6 ## Copyright (C) 2002 Earl Hood <earl@earlhood.com>
8 ## This program is free software; you can redistribute it and/or modify
9 ## it under the terms of the GNU General Public License as published by
10 ## the Free Software Foundation; either version 2 of the License, or
11 ## (at your option) any later version.
13 ## This program is distributed in the hope that it will be useful,
14 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ## GNU General Public License for more details.
18 ## You should have received a copy of the GNU General Public License
19 ## along with this program; if not, write to the Free Software
20 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 ##---------------------------------------------------------------------------##
24 package MHArc
::ListDef
;
26 sub _DEF_ORDER
() { return '-X-DEF-ORDER-'; }
30 my $mod = shift; # Name of module
31 my $fh = shift; # Filehandle to read definitions from
32 my $class = ref($mod) || $mod;
35 $self->{_DEF_ORDER
} = [ ];
36 $self->load_file($fh);
46 if (!open(LISTDEF
, $file)) {
47 die qq/ERROR: Unable to open "$file": $!\n/;
58 while (defined($line = <$fh>)) {
59 next unless $line =~ /\S/;
60 next if $line =~ /^\s*#/;
62 ($key, $value) = $line =~ /^([^:]+):\s*(.*)$/;
67 push(@
{$self->{_DEF_ORDER
}}, $name);
68 $self->{$name}{'name'} = [ $name ];
71 if (!defined($name)) {
72 warn qq/Warning: No name defined for '$line'\n/;
76 if (defined($self->{$name}{$key})) {
77 push(@
{$self->{$name}{$key}}, $value);
79 $self->{$name}{$key} = [ $value ];
92 @
{$self->{_DEF_ORDER
}};
100 MHArc::ListDef - Load mailing lists definition file
104 $def = MHArc::ListDef->new($fh);
105 $def = MHArc::ListDef->new($filename);
107 # Return list of names in order defined
108 @names = $def->get_names;
111 $description = $def->{$name}{'description'}[0];
115 This module parses a mailing list definition file for use in the
116 auto-mail archiving system.
118 The C<new> method either takes a filehandle reference or a filename
123 L<mk-procmailrc|mk-procmailrc>
127 C<$Id: ListDef.pm,v 1.5 2003/07/16 00:49:58 ehood Exp $>
131 Earl Hood, earl@earlhood.com
133 This module is part of the mharc archiving system and comes with
134 ABSOLUTELY NO WARRANTY and may be copied only under the terms of
135 the GNU General Public License, which may be found in the MHArc