NAME UNIVERSAL::AUTHORITY - adds an AUTHORITY method to UNIVERSAL SYNOPSIS if (HTML::HTML5::Writer->AUTHORITY ne HTML::HTML5::Builder->AUTHORITY) { warn "Closely intertwined modules with different authors!\n"; warn "There may be trouble ahead..."; } # Only trust STEVAN's releases Moose->AUTHORITY('cpan:STEVAN'); # dies if doesn't match DESCRIPTION This module adds an "AUTHORITY" function to the "UNIVERSAL" package, which works along the same lines as the "VERSION" function. Because it is defined in "UNIVERSAL", it becomes instantly available as a method for any blessed objects, and as a class method for any package. The authority of a package can be defined like this: package MyApp; BEGIN { $MyApp::AUTHORITY = 'cpan:JOEBLOGGS'; } The authority should be a URI identifying the person, team, organisation or trained chimp responsible for the release of the package. The pseudo-URI scheme "cpan:" is the most commonly used identifier. "UNIVERSAL::AUTHORITY" Called with no parameters returns the authority of a CPAN release. "UNIVERSAL::AUTHORITY($test)" If passed a test, will croak if the test fails. The authority is tested against the test using something approximating Perl 5.10's smart match operator. (Briefly, you can pass a string for "eq" comparison, a regular expression, a code reference to use as a callback, or an array reference that will be grepped.) Utility Function "UNIVERSAL::AUTHORITY::reasonably_smart_match($a, $b)" UNIVERSAL::AUTHORITY exposes its smart match implementation in case classes wish to reuse it for their own custom "AUTHORITY" methods. (There are various interesting use cases for custom "AUTHORITY" methods, just as there are for custom "can" and "isa" methods.) The $a parameter is assumed to be a scalar. BUGS Please report any bugs to . SEE ALSO authority, authority::shared, , . UNIVERSAL, UNIVERSAL::which, UNIVERSAL::dump, UNIVERSAL::DOES, &c. AUTHOR Toby Inkster . COPYRIGHT AND LICENCE This software is copyright (c) 2011 by Toby Inkster. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. 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.