This error message has nothing to do with your import
method. You are not overriding an import
method that Moose has installed into your class, because Moose doesn't install any such method into your class.
It is because Moose exports a function called with
, but your package already contains a function called with
. At a guess, you're using the venerable Error.pm for exception handling; that exports a function called with
. This is a known incompatibility.
My suggestions:
- Error.pm is no longer recommended by its maintainers. For try/catch, switch to Try::Tiny.
- The Error::Simple base class for exceptions is part of the same distribution as Error.pm. Consider switching to Throwable::Error.
- This
import
method seems like a pretty weird attempt at security. How about renaming theClient
class something likeCertainTeam::Internal::Client
? While this wouldn't stop other people using it, anybody who litters their code with references to what is clearly another team's internal client is inviting trouble. The only guarantee they get is that if their code breaks, they can keep both halves.