NAME

Perl::Critic::Policy::Subroutines::ProhibitCallsToUnexportedSubs

AFFILIATION

This policy is part of Perl::Critic::StricterSubs.

DESCRIPTION

Many Perl modules define their public interface by exporting subroutines via Exporter. The goal of this Policy is to enforce encapsulation by by prohibiting calls to subroutines that are not listed in the callee's @EXPORT or @EXPORT_OK.

LIMITATIONS

This Policy does not properly deal with the only pragma or modules that don't use Exporter for their export mechanism, such as CGI. In the near future, we might fix this by allowing you configure the policy with a list of packages that are exempt from this policy.

DIAGNOSTICS

Subroutines::ProhibitCallsToUnexportedSubs: Cannot find source file

This warning usually indicates that the file under analysis includes modules that are not installed in this perl's <@INC> paths. See "CONFIGURATION" for controlling the @INC list this Policy.

This warning can also happen when one of the included modules contains multiple packages, or if the package name doesn't match the file name. Perl::Critic advises against both of these conditions, and has additional Policies to help enforce that.

SEE ALSO

Perl::Critic::Policy::Modules::ProhibitMultiplePackages

Perl::Critic::Policy::Modules::RequireFilenameMatchesPackage

AUTHOR

Jeffrey Ryan Thalhammer <thaljef@cpan.org>

COPYRIGHT

Copyright 2007-2024 Jeffrey Ryan Thalhammer and Andy Lester

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module.