Toby Inkster > UNIVERSAL-AUTHORITY-Lexical-0.002 > UNIVERSAL::AUTHORITY::Lexical

Download:
UNIVERSAL-AUTHORITY-Lexical-0.002.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  1
View/Report Bugs
Module Version: 0.002   Source   Latest Release: UNIVERSAL-AUTHORITY-Lexical-0.003

NAME ^

UNIVERSAL::AUTHORITY::Lexical - an AUTHORITY method for every class, within a lexical scope

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 method 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 method is defined only for the lexical scope you import this package into. For example:

  {
    use UNIVERSAL::AUTHORITY::Lexical;
    say Moose->AUTHORITY;
  }
  say Moose->AUTHORITY;  # no such method, dies.

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.

AUTHORITY

Called with no parameters returns the authority of a CPAN release.

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.)

BUGS ^

Currently UNIVERSAL->can('AUTHORITY') returns false.

Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=UNIVERSAL-AUTHORITY-Lexical.

SEE ALSO ^

Background reading: http://feather.perl6.nl/syn/S11.html, http://www.perlmonks.org/?node_id=694377.

AUTHOR ^

Toby Inkster <tobyink@cpan.org>.

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.

syntax highlighting: