Support 9210 CSV contacts format.
[PerlMail.git] / contacts-n9k2mutt
index 81aa704..bba3b46 100755 (executable)
@@ -32,9 +32,16 @@ Getopt::Long::Configure(
                "no_ignorecase",
                "bundling",
                );
+my $opt_9000;
 die if !Getopt::Long::GetOptions(
+               "9000"=>\$opt_9000,
                );
 
+my $type="9210";
+$type="9000" if $opt_9000;
+my $class="PerlMail::Contacts::$type";
+eval "require $class;1;" or die "Cannot load loader $class: $!";
+
 undef $/;
 while (<>) {
        my @data=map({
@@ -50,7 +57,7 @@ while (<>) {
                                                        "iscompany"=>($record{"Name"} && $record{"Company"} && $record{"Name"} eq $record{"Company"}),
                                                        }));
                                        } @record);
-                       } PerlMail::Contacts::9000->in($_));
+                       } $class->in($_));
        my @nicked=map({
                        my $data=$_;
                        my($name,$mail,$attr,$iscompany)=map(($data->{$_}),qw(name mail attr iscompany));