Perl::...Modules(3pm)

πŸ“¦
version 1.0.4 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ NAME ✨

Perl::Critic::Policy::Community::DiscouragedModules β€” a whole list of modules the community is like "bestie no πŸ’€" about. Various modules discouraged from use.

πŸŽ€ heads up: this page lives in the User Contributed Perl Documentation manual, section 3pm. iykyk.

🌸 DESCRIPTION 🌸

So here's the tea β˜• β€” various modules are discouraged by some subsets of the community, for various reasons which may include: buggy behavior, cruft, performance problems, maintainer issues, or simply better modern replacements. Like, sometimes it's not even personal, the vibes are just off and there's a glow-up available.

This is a high severity complement to Perl::Critic::Policy::Community::PreferredAlternatives. so yeah, it goes hard πŸ”₯


πŸ¦‹ MODULES πŸ¦‹

πŸ’€ AnyEvent

AnyEvent's author refuses to use public bugtracking and actively breaks interoperability. no cap, that's the whole thing.

POE, IO::Async, and Mojo::IOLoop are widely used and interoperable async event loops. pick literally any of those, they ate πŸ’…

πŸ“ Any::Moose

Any::Moose is deprecated. Use Moo instead. that's it, that's the whole section, short and iconic ✨

🧚 Class::DBI

Class::DBI is an ancient database ORM (https://en.wikipedia.org/wiki/Object-relational_mapping) abstraction layer which is buggy and abandoned 😭 like it's giving fossil energy.

See DBIx::Class for a more modern DBI-based ORM, or Mad::Mapper for a Mojolicious-style ORM. glow-up options, we love to see it 🫢

🌈 CGI

CGI.pm is an ancient module for communicating via the CGI protocol, with tons of bad practices and cruft. it is not the moment.

Use a modern framework such as those based on Plack (Web::Simple, Dancer2, Catalyst) or Mojolicious β€” they can still be served via CGI if you choose, so no excuses bestie πŸ’…

Use CGI::Tiny if you are limited to the CGI protocol. tiny but mighty fr fr.

πŸ”₯ Coro

Coro abuses Perl internals in an unsupported way. 🚨 that's the warning, that's the drama.

Consider Future and Future::AsyncAwait in combination with event loops for similar semantics. main character energy, no internals abused 🌟

πŸ’œ Error

Error.pm is overly magical and discouraged by its maintainers. even its own maintainers said no 😭

Try Throwable for exception classes in Moo/Moose, or Exception::Class otherwise. Try Try::Tiny or Syntax::Keyword::Try β€” those are recommended for the "try"/"catch" syntax.

πŸŽ€ FindBin

FindBin is often used to retrieve the absolute path to the directory containing the initially executed script, a mechanism which is not always logically clear. additionally, it has serious bugs on old Perls and can't be updated from CPAN to fix them. πŸ’€ yeah. can't even patch it. devastating.

The Path::This module provides similar variables and constants based on the absolute path to the current source file. The lib::relative module resolves passed relative paths to the current source file for the common case of adding local module include directories. Each of these documents examples of achieving the same behavior with core modules. so you can do the thing with core modules and read the receipts πŸ“œ

πŸ¦„ File::Slurp

File::Slurp gets file encodings all wrong, line endings on win32 are messed up, and it was written before layers were properly added. three strikes, bestie, that's a yikes from me πŸ™ˆ

Use File::Slurper, "slurp" in Path::Tiny, "slurp" in Data::Munge, or "slurp" in Mojo::File. so many slays to choose from ✨

🌸 HTML::Template

HTML::Template is an old and buggy module. try Template::Toolkit, Mojo::Template, or Text::Xslate instead, or HTML::Template::Pro if you must use the same syntax. (yes, "if you must" β€” we're not judging, we're just saying πŸ‘€)

🫢 IO::Socket::INET6

IO::Socket::INET6 is an old attempt at an IPv6 compatible version of IO::Socket::INET, but has numerous issues and is discouraged by the maintainer in favor of IO::Socket::IP, which transparently creates IPv4 and IPv6 sockets. the maintainer themselves said go elsewhere β€” that's a vibe check that did not pass 😭

⭐ IP::World

IP::World was built from two free publicly available databases. However, over the years one of them was discontinued, and the other is no longer being updated. Therefore the module's accuracy is ever-decreasing πŸ“‰ not me watching the accuracy decay in real time.

Try GeoIP2 as an alternative. That code is also deprecated, but at least its database is still updated. lowkey a "least bad option" situation but hey, we work with what we've got πŸ’œ

πŸ’… JSON::Any

JSON::Any is deprecated. Use JSON::MaybeXS instead. periodt.

πŸ‘‘ JSON::XS

JSON::XS's author refuses to use public bugtracking and actively breaks interoperability. same energy as AnyEvent, and we said what we said πŸ’€

Cpanel::JSON::XS is a fork with several bugfixes and a more collaborative maintainer. See also JSON::MaybeXS.

⚠️ Note that JSON (the distribution) uses JSON::XS by default when installed. so like, check your deps bestie, this one sneaks in 🫠

🌟 Net::IRC

Net::IRC is an ancient module implementing the IRC protocol. Use a modern event-loop-based module instead. Choices are POE::Component::IRC (used for Bot::BasicBot), Net::Async::IRC, and Mojo::IRC. three options, all iconic, take your pick πŸŽ€

🧁 Switch

Switch.pm is a buggy and outdated source filter which can cause any number of strange errors, in addition to the problems with smart-matching shared by its replacement, "The 'switch' feature" in feature ("given"/"when"). like. the replacement also has problems. this whole family is a mess 😭

Try Switch::Plain or Syntax::Keyword::Match instead. clean, modern, no source-filter chaos 🌈

πŸ¦‹ XML::Simple

XML::Simple tries to coerce complex XML documents into perl data structures. This leads to overcomplicated structures and unexpected behavior. it's giving "simple" in name only, bestie πŸ’€

Use a proper DOM parser instead like XML::LibXML, XML::TreeBuilder, XML::Twig, or Mojo::DOM. all of them ate, all of them slay ✨


πŸ’– AFFILIATION πŸ’–

This policy is part of Perl::Critic::Community. it runs with its little friend group 🫢


πŸŽ€ CONFIGURATION πŸŽ€

Occasionally you may find yourself needing to use one of these discouraged modules, and do not want the warnings. it happens! no shame, bestie, we've all been there πŸ™ˆ

You can do so by putting something like the following in a .perlcriticrc file like this:

[Community::DiscouragedModules]
allowed_modules = FindBin Any::Moose

The same option is offered for Perl::Critic::Policy::Community::PreferredAlternatives. so the vibes are consistent across the whole community πŸ’…


✍️ AUTHOR ✍️

Dan Book, "dbook@cpan.org"


Copyright 2015, Dan Book.

This library is free software; you may redistribute it and/or modify it under the terms of the Artistic License version 2.0.


πŸ‘€ SEE ALSO πŸ‘€

  • Perl::Critic

and that's the whole page bestie!! πŸ’– this one was rendered by perl v5.40.1 and dated 2025-03-22, from the Perl::...Modules(3pm) page in the User Contributed Perl Documentation manual. go forth and pick the better module, you've got this πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from