pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:

Hello, Monks.

I'm writing Authen::Simple::IMAP which needs to support both IMAP and IMAPS. I had Net::IMAP::Simple and Net::IMAP::Simple::SSL already installed, so I used those. Now I'm running my tests and I discover that Net::IMAP::Simple has some known bugs and seems to be abandoned. Someone has even written Net::IMAP::Simple::Plus which installs a patched version of Net::IMAP::Simple.pm.

What's the best way to handle this? Should I use different IMAP/IMAPS modules? Should I require Net::IMAP::Simple::Plus? Disable warnings for this bit of code? Other ideas?

Thanks!
--Pileofrogs

Replies are listed 'Best First'.
Re: IMAP & IMAPS module?
by shmem (Chancellor) on Mar 11, 2009 at 22:24 UTC

    Net::IMAP::Simple (and ::Plus) have a login method, don't they? What does your package provide? It looks to me like Net::IMAP::Simple (and ::Plus) ought to use your module, not the other way round. But that's hard to tell without seeing any of source or POD ;-)

      Sorry, I seem to have omitted that important detail:

      Authen::Simple and co are there to make it easy for you to add authentication to your perl code. So, if you want to authenticate users against an LDAP server? There's Authen::Simple::LDAP. How about an active directory server? Authen::Simple::ActiveDirectory. I'm building a catalyst app that will authenticate against an IMAP server. Hence, Authen::Simple::IMAP. So, I'm not adding authentication to an IMAP service, I'm using an IMAP server as my credential provider.

        Ah, ok. Since the bits Net::IMAP::Simple::Plus provides are irrelevant for pure authentication, and you still would prefer Net::IMAP::Simple::Plus, you could try to load Net::IMAP::Simple::Plus and fall back to Net::IMAP::Simple via a BEGIN block and string eval:

        package Authen::Simple::LDAP; BEGIN { eval "use Net::IMAP::Simple::Plus;"; if ($@) { eval "use Net::IMAP::Simple;"; die $@ if $@; } }
Re: IMAP & IMAPS module?
by CountZero (Bishop) on Mar 12, 2009 at 14:10 UTC
    As you only need the authentication part(s) of the IMAP-modules, wouldn't it be better if you provide it yourself in your module, rather than loading another module of which probably 90% of the code is irrelevant for you? Especially if this other module is buggy and not being actively maintained?

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James