authority::shared(3pm)

authority::shared3pm

A multi-authority method for your classes

Usage

 package MyApp;
 BEGIN { $MyApp::AUTHORITY = 'cpan:JOE'; }
 use authority::shared qw(cpan:ALICE cpan:BOB);
 
 package main;
 use feature qw(say);
 say scalar MyApp->AUTHORITY;     # says "cpan:JOE"
 MyApp->AUTHORITY('cpan:JOE');    # lives
 MyApp->AUTHORITY('cpan:ALICE');  # lives
 MyApp->AUTHORITY('cpan:BOB');    # lives
 MyApp->AUTHORITY('cpan:CAROL');  # croaks

Overview

This module allows you to indicate that your module is issued by multiple authorities. The package variable $AUTHORITY should still be used to indicate the primary authority for the package.

This module does two simple things:

1. Creates an @AUTHORITIES array in the caller package, populating it with the arguments passed to "authority::shared" on the "use" line.
2. Exports an AUTHORITY function to your package that reads the $AUTHORITY and @AUTHORITIES package variables.

The main use case for shared authorities is for team projects. The team would designate a URI to represent the team as a whole. For example, "http://datetime.perl.org/", "http://moose.iinteractive.com/" or "http://www.perlrdf.org/". Releases can then be officially stamped with the authority of the team using:

 use authority::shared q<http://www.perlrdf.org/>;

And users can check they have an module released by the official team using:

 RDF::TakeOverTheWorld->AUTHORITY(q<http://www.perlrdf.org/>);

which will croak if package RDF::TakeOverTheWorld doesn't have the specified authority.

Disclaimer of warranties

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

Bugs

An obvious limitation is that this module relies on honesty. Don't release modules under authorities you have no authority to use.

Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=authority-shared <http://rt.cpan.org/Dist/Display.html?Queue=authority-shared>.

Author

Toby Inkster <[email protected]>.

From libauthority-shared-perl 0.006-1 in Debian 7 (Wheezy). Parsed by carta from the page's man source.