Best practice to gracefully fallback in perl module if log4perl not installed

47 Views Asked by At

Ok, so I'm trying to learn to properly use log4perl.

It seems like it would make sense that I could write a module that uses log4perl, but can also be distributed to a system where log4perl is not installed and still run without failing, just not log. If I have use Log::Log4Perl qw(:easy); in the module, compile fails with:

Can't locate Log/Log4Perl.pm in @INC ...

Basically, what is standard and best practice among users of log4perl to enable log4perl compatibility in a module without forcing it? It seems like something that should be common, but I can't find it to save my life.

Thanks in advance.

EDIT: Thanks for the feedback! I have edited the question to reflect that I am looking for the best practice among users of log4perl in this situation, given that certainly this must be a common issue among log4perl users... right?

0

There are 0 best solutions below