According to Dist::Zilla::Plugin::Authority :
This plugin adds the authority data to your distribution. It adds the data to your modules and metadata. Normally it looks for the PAUSE author id in your Dist::Zilla configuration.
What is the "authority data" used for? Why is it added to all the modules?
In Raku, a module (actually any type) can have attributes
:ver<>
,:auth<>
and:api<>
. This allows you to pass it a version, author, and/or API number, which you can subsequently introspect.In Perl, the authority of a package can be defined like this:
The authority should be an URI identifying the person, team, or organisation responsible for the release of the package. The pseudo-URI scheme
cpan:
is the most commonly used identifier.The
$AUTHORITY
package variable can be used together with the authority pragma to load a module conditionally based on its authority:Assuming that the
@INC
path is/opt/perl/lib
, then Perl will attempt to load/opt/perl/lib/cpan_3A_JOE/My/Module.pm
before it tries the usual/opt/perl/lib/My/Module.pm
.Also having a defined
$AUTHORITY
, enables module authority introspection with UNIVERSAL::AUTHORITY::Lexical. For example:and
See also our $AUTHORITY for the original discussion on this variable.