The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

registry

ABSTRACT

Register Type Libraries with Namespace

SYNOPSIS

  package main;

  use strict;
  use warnings;
  use registry;

  $registry;

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

DESCRIPTION

This pragma is used to associate namespaces 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;

  # my $constraint = $registry->('main')->lookup('StrLength[10]')

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

AUTHOR

Al Newkirk, awncorp@cpan.org

LICENSE

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

PROJECT

Wiki

Project

Initiatives

Milestones

Contributing

Issues