Perl::...edSubs(3pm)

πŸ“¦
version 0.08 Β· 2 versions
, in fedora 43

πŸ’… Perl::...edSubs(3pm)

okay bestie, welcome to the User Contributed Perl Documentation section of the manual πŸ’– this one's a Perl::Critic policy page, and yes the name is a whole mouthful, buckle up πŸŽ€


✨ NAME ✨

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

that's it. that's the name. it's giving "policy that yells at you for calling subs you weren't supposed to call" and honestly? iconic 🫢


🌸 AFFILIATION 🌸

this policy is part of Perl::Critic::StricterSubs. no cap, it lives there.


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the vibe. a LOT of Perl modules define their public interface by exporting subroutines via Exporter. that's just how they do it.

the goal of this Policy is to enforce encapsulation by prohibiting calls to subroutines that are not listed in the callee's @EXPORT or @EXPORT_OK.

so like β€” if it's not on the guest list, you're not getting in. periodt πŸ’…


πŸ’€ LIMITATIONS πŸ’€

ngl, this Policy does not properly deal with the only pragma or modules that don't use Exporter for their export mechanism, such as CGI. it's just not equipped, bestie 😭

in the near future, they might fix this by letting you configure the policy with a list of packages that are exempt from this policy. until then? shrug πŸ’œ


🌈 DIAGNOSTICS 🌈

  • "Subroutines::ProhibitCallsToUnexportedSubs: Cannot find source file" β€” okay so this warning usually means 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 uses πŸ‘‘
also lowkey this warning can 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. so like… don't do that πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘

  • Perl::Critic::Policy::Modules::ProhibitMultiplePackages
  • Perl::Critic::Policy::Modules::RequireFilenameMatchesPackage

go read those too, fr fr πŸ“šβœ¨


πŸŽ€ AUTHOR πŸŽ€

Jeffrey Ryan Thalhammer <thaljef@cpan.org>


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.


and that's the whole page, bestie!! πŸ₯³ no notes, ate and left no crumbs. this was served up from perl v5.42.0 on 2025-07-25 β€” Perl::...edSubs(3pm), signing off πŸ’…πŸŒΈπŸ«Ά

πŸ“¦ where this page comes from