What is the conventional wisdom (if any) for handling conditional
dependencies in modules?

For example, I have a logger class wrapped around Log4perl that
supports screen, email, and syslog appenders, and each appender can be
individually toggled on or off. Is it better to force the dependencies
on the underlying syslog and email modules at the top of the logger
class, or is it acceptable to bury those imports in the methods that
actually do the initialization of each appender? It sort of comes down
to whether I want the issue detected at compile time or run time I
suppose, but is generally frowned upon to put imports down inside
class methods?

Thanks for any insight.

m.

Reply via email to