use constant HAVE_XYZ => !!$ENV{USE_XYZ}; use if HAVE_XYZ, 'XYZ'; ... if ( HAVE_XYZ ) { XYZ::foo(...) }