?

Log in

No account? Create an account

Thu, Dec. 8th, 2005, 12:00 pm
Urge. To. Rewrite. Email::Store. Rising.

I really hate the Class method design of Email::Store - something that just doesn't make sense to me but which I inherited nonetheless.

If I ever get the time I'm pondering rewriting it as object method because, it sort of makes sense to me - a store is an object and messages and threads etc etc are objects that can be retrieved from the store.

    my $store = Email::Store->new(%config);
    foreach my $list ($store->lists()) {
        print "List: $list->name has ".scalar($list->messages)." messages\n";        
    }
    my $message = $store->message($message_id);
    print "Subject: $message->subject\n";
    print "From: $message->from\n";
    foreach my $attachment ($message->attachments) {
        print "\t$attachement->filename\n";
    }
    $store2->add($message);

So now I need to

1) Find out why the original author did it like he did

2) Work out how to deal sensibly with a complete and utter API breakage and any existing users (call it Email::Store2 maybe ?)

3) Find time. Always with the time finding.