Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up modules' exporting/importing symbols #534

Merged
merged 33 commits into from
Oct 16, 2024

Conversation

gemmaro
Copy link
Contributor

@gemmaro gemmaro commented Oct 14, 2024

This is a continuation from #533.

According to the Exporter's perldoc, this change follows the rationales:

  • Do as little exporting as possible.
  • If exporting is necessary, use @EXPORT_OK.
    • Except for Testhelper; It sounds natural to align with Test::More.
  • And make sure that the relationships (and inheritance) between modules are clear.

Commits are grouped as follows.

  • Common module
  • Po module
  • TransTractor module
  • Each format modules (from ancestor to descendant)

Followings are not the targets of this pull request:

  • Remove @AUTOLOAD variable declarations
  • Remove unused makespace subroutine declarations
  • Use our for the version variable

Thank you,


TODO list:

  • Use @EXPORT_OK instead of @EXPORT in the Xml module, or remove it and use explicit calling
  • Tidy commits (improve message, merge some of them, and etc.)
  • Maybe split into several pull requests
  • Check each commits again

* lib/Locale/Po4a/Common.pm: Remove the "textdomain" subroutine from
export-list in Common module.  The every callers use the fully qualified
subroutine name.
* scripts/msgsearch: Use fully qualified method name "textdomain" in
the msgsearch script.
* lib/Locale/Po4a/Common.pm: Explicitly export the Common module's
wrap_msg subroutine.  @EXPORT_OK is preferred way of exporting to
@export.
* lib/Locale/Po4a/Chooser.pm, lib/Locale/Po4a/TransTractor.pm,
lib/Locale/Po4a/Wml.pm, msguntypot, po4a, po4a-gettextize,
po4a-normalize, po4a-translate, po4a-updatepo: Explicitly import the
Common module's wrap_msg subroutine.
* lib/Locale/Po4a/Common.pm: Explicitly export the Common module's
"wrap_mod" subroutine.  @EXPORT_OK is the preferred way to export.
* lib/Locale/Po4a/AsciiDoc.pm, lib/Locale/Po4a/Chooser.pm,
lib/Locale/Po4a/InProgress/Debconf.pm, lib/Locale/Po4a/Man.pm,
lib/Locale/Po4a/Org.pm, lib/Locale/Po4a/Pod.pm,
lib/Locale/Po4a/RubyDoc.pm, lib/Locale/Po4a/Sgml.pm,
lib/Locale/Po4a/TeX.pm, lib/Locale/Po4a/Text.pm,
lib/Locale/Po4a/TransTractor.pm, lib/Locale/Po4a/Xhtml.pm,
lib/Locale/Po4a/Xml.pm, lib/Locale/Po4a/Yaml.pm, po4a-gettextize:
Explicitly import the Common module's "wrap_mod" subroutine.
* lib/Locale/Po4a/Common.pm: Explicitly export the Common's
"wrap_ref_mod" subroutine.  @EXPORT_OK is the preferred way of
exporting to @export.
* lib/Locale/Po4a/InProgress/NewsDebian.pm,
lib/Locale/Po4a/KernelHelp.pm, lib/Locale/Po4a/Man.pm,
lib/Locale/Po4a/Sgml.pm, lib/Locale/Po4a/TeX.pm,
lib/Locale/Po4a/Xml.pm, po4a: Explicitly import the Common's
"wrap_ref_mod" subroutine.
* lib/Locale/Po4a/Common.pm: Explicitly export the Common's
"gettext" subroutine.  The @EXPORT_OK is the preferred way of
exporting to @export.
* lib/Locale/Po4a/Chooser.pm, lib/Locale/Po4a/KernelHelp.pm,
lib/Locale/Po4a/TransTractor.pm, lib/Locale/Po4a/Wml.pm, msguntypot,
po4a, po4a-gettextize, po4a-normalize, po4a-translate, po4a-updatepo,
scripts/msgsearch: Explicitly import the Common's "gettext"
subroutine.
* lib/Locale/Po4a/Common.pm: Explicitly export the Common's "dgettext"
subroutine.  The @EXPORT_OK is the preferred way to export.
* lib/Locale/Po4a/AsciiDoc.pm, lib/Locale/Po4a/InProgress/Debconf.pm,
lib/Locale/Po4a/InProgress/NewsDebian.pm, lib/Locale/Po4a/Man.pm,
lib/Locale/Po4a/Org.pm, lib/Locale/Po4a/Pod.pm,
lib/Locale/Po4a/RubyDoc.pm, lib/Locale/Po4a/Sgml.pm,
lib/Locale/Po4a/TeX.pm, lib/Locale/Po4a/Text.pm,
lib/Locale/Po4a/TransTractor.pm, lib/Locale/Po4a/Xhtml.pm,
lib/Locale/Po4a/Xml.pm, lib/Locale/Po4a/Yaml.pm, po4a,
po4a-gettextize, po4a-normalize: Explicitly import the Common's
"dgettext" subroutine.
* lib/Locale/Po4a/Po.pm: Do not export the %debug variable by default
from the Po module.  The variable is not used anywhere unconditionally.
* lib/Locale/Po4a/Po.pm: Removed the TransTractor module from the Po
module.  Po and TransTractor used to "use" each others.
* lib/Locale/Po4a/TransTractor.pm: There were TransTractor's export
list, but they were not used anywhere.
* lib/Locale/Po4a/AsciiDoc.pm: Removed the empty export-list from the
AsciiDoc module.  The @export variable was empty.
* lib/Locale/Po4a/InProgress/Debconf.pm: Removed the empty export-list
from the Debconf module.  The @export list was empty.
* lib/Locale/Po4a/Gemtext.pm: Removed the Exporter and the @export
variable from the Gemtext module.  The @export list was empty.
* lib/Locale/Po4a/KernelHelp.pm: Removed the Exporter module and the
@export variable from the KernelHelp module.  The list was empty.
* lib/Locale/Po4a/Man.pm: Removed the empty export-list from the Man
module.  The @export list was empty.
* lib/Locale/Po4a/InProgress/NewsDebian.pm: Removed the empty
export-list from the NewsDebian module.  The @export list was empty.
* lib/Locale/Po4a/Pod.pm: Removed the Exporter module from the Pod
module.  There is nothing to export.
* lib/Locale/Po4a/RubyDoc.pm: Removed the Exporter module from the
RubyDoc module.  There was no export-list.
* lib/Locale/Po4a/BibTeX.pm: Removed the empty export-list from the
BibTeX module.  The @export list was empty.
* lib/Locale/Po4a/TeX.pm: Removed the Exporter module from the TeX
module.  The exported symbols were not used implicitly by its child modules.
* lib/Locale/Po4a/Halibut.pm: Removed the empty export-list from the
Halibut module.  The @export list was empty.
* lib/Locale/Po4a/LaTeX.pm: Removed the empty export-list from the
LaTeX module.  The @export list was empty.
* lib/Locale/Po4a/Texinfo.pm: Removed the empty export-list from the
Texinfo module.  The @export list was empty.
* lib/Locale/Po4a/Ini.pm: Removed the Exporter module and the @export
variable from the Ini module.  The @export list was empty.
* lib/Locale/Po4a/Yaml.pm: Removed the Exporter module and the
@export variable from the Yaml module.  The list was empty.
* lib/Locale/Po4a/Text.pm: Removed the empty export-list from the Text
module.  The @export list was empty.
* lib/Locale/Po4a/Sgml.pm: Removed the empty export-list from the Sgml
module.  The @export list was empty.
* lib/Locale/Po4a/Xml.pm: Removed the Xml module's "new" subroutine
symbol from its export list.  The Xml module inherits from the
TransTractor module and uses the TransTractor's "new" subroutine.
* lib/Locale/Po4a/Wml.pm: Removed the empty export-list from the Wml
module.  The @export list was empty.
@gemmaro gemmaro marked this pull request as ready for review October 15, 2024 11:46
@mquinson
Copy link
Owner

Thank you very much for this change @gemmaro. I reviewed it, and it sounds good. I'm so happy that you help me preventing this code from rotting. Please do not hesitate to do the cleanups that were not target of this PR if you feel so :)

@mquinson mquinson merged commit 3266006 into mquinson:master Oct 16, 2024
1 check passed
@gemmaro gemmaro deleted the exporter branch October 16, 2024 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants