1Specio::Exporter(3)   User Contributed Perl Documentation  Specio::Exporter(3)
2
3
4

NAME

6       Specio::Exporter - Base class for type libraries
7

VERSION

9       version 0.48
10

SYNOPSIS

12           package MyApp::Type::Library;
13
14           use parent 'Specio::Exporter';
15
16           use Specio::Declare;
17
18           declare( ... );
19
20           # more types here
21
22           package MyApp::Foo;
23
24           use MyApp::Type::Library
25

DESCRIPTION

27       Inheriting from this package makes your package a type exporter. By
28       default, types defined in a package are never visible outside of the
29       package. When you inherit from this package, all the types you define
30       internally become available via exports.
31
32       The exported types are available through the importing package's "t"
33       subroutine.
34
35       By default, types your package imports are not re-exported:
36
37         package MyApp::Type::Library;
38
39         use parent 'Specio::Exporter';
40
41         use Specio::Declare;
42         use Specio::Library::Builtins;
43
44       In this case, the types provided by Specio::Library::Builtins are not
45       exported to packages which "use MyApp::Type::Library".
46
47       You can explicitly ask for types to be re-exported:
48
49         package MyApp::Type::Library;
50
51         use parent 'Specio::Exporter';
52
53         use Specio::Declare;
54         use Specio::Library::Builtins -reexport;
55
56       In this case, packages which "use MyApp::Type::Library" will get all
57       the types from Specio::Library::Builtins as well as any types defined
58       in "MyApp::Type::Library".
59

ADDITIONAL EXPORTS

61       If you want to export some additional subroutines from a package which
62       has "Specio::Exporter" as its parent, define a sub named
63       "_also_export". This sub should return a list of subroutines defined in
64       your package that should also be exported. These subs will be exported
65       unconditionally to any package that uses your package.
66

COMBINING LIBRARIES WITH Specio::Subs

68       You can combine loading libraries with subroutine generation using
69       Specio::Subs by using "_also_export" and
70       "Specio::Subs::subs_installed_into":
71
72           package My::Library;
73
74           use My::Library::Internal -reexport;
75           use Specio::Library::Builtins -reexport;
76           use Specio::Subs qw( My::Library::Internal Specio::Library::Builtins );
77
78           sub _also_export {
79               return Specio::Subs::subs_installed_into(__PACKAGE__);
80           }
81

SUPPORT

83       Bugs may be submitted at
84       <https://github.com/houseabsolute/Specio/issues>.
85

SOURCE

87       The source code repository for Specio can be found at
88       <https://github.com/houseabsolute/Specio>.
89

AUTHOR

91       Dave Rolsky <autarch@urth.org>
92
94       This software is Copyright (c) 2012 - 2022 by Dave Rolsky.
95
96       This is free software, licensed under:
97
98         The Artistic License 2.0 (GPL Compatible)
99
100       The full text of the license can be found in the LICENSE file included
101       with this distribution.
102
103
104
105perl v5.36.0                      2023-01-20               Specio::Exporter(3)
Impressum