GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
registry(3) User Contributed Perl Documentation registry(3)

registry

Register Type Libraries with Namespaces

  package main;

  use strict;
  use warnings;
  use registry;

  $registry;

  # $registry->('main')
  # 'main' Type::Registry object

  # or ...
  # return registry object based on caller
  # registry::access('main')

  # and ...
  # resolve type expressions based on caller
  # registry::lookup('ClassName')

This pragma is used to associate the calling package with Type::Tiny type libraries. A $registry variable is made available to the caller to be used to access registry objects. The variable is a callback (i.e. coderef) which should be called with a single argument, the namespace whose registry object you want, otherwise the argument defaults to "main".

  package main;

  use strict;
  use warnings;

  use registry 'Types::Standard';
  use registry 'Types::Common::Numeric';
  use registry 'Types::Common::String';

  $registry;

  # resolve type expression using exported variable
  # my $constraint = $registry->('main')->lookup('StrLength[10]')

  # resolve type expression using registry function
  # my $constraint = registry::lookup('StrLength[10]', 'main')

You can configure the calling package to be associated with multiple distinct type libraries. The exported $registry object can be used to reify type constraints and resolve type expressions.

Al Newkirk, "awncorp@cpan.org"

Copyright (C) 2011-2019, Al Newkirk, et al.

This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file" <https://github.com/iamalnewkirk/routines/blob/master/LICENSE>.

Wiki <https://github.com/iamalnewkirk/routines/wiki>

Project <https://github.com/iamalnewkirk/routines>

Initiatives <https://github.com/iamalnewkirk/routines/projects>

Milestones <https://github.com/iamalnewkirk/routines/milestones>

Contributing <https://github.com/iamalnewkirk/routines/blob/master/CONTRIBUTE.md>

Issues <https://github.com/iamalnewkirk/routines/issues>

2019-10-13 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.