1Rose::DB::Registry(3) User Contributed Perl DocumentationRose::DB::Registry(3)
2
3
4

NAME

6       Rose::DB::Registry - Data source registry.
7

SYNOPSIS

9         use Rose::DB::Registry;
10
11         $registry = Rose::DB::Registry->new;
12
13         $registry->add_entry(
14           domain   => 'development',
15           type     => 'main',
16           driver   => 'Pg',
17           database => 'dev_db',
18           host     => 'localhost',
19           username => 'devuser',
20           password => 'mysecret',
21           server_time_zone => 'UTC');
22
23         $entry = Rose::DB::Registry::Entry->new(
24           domain   => 'production',
25           type     => 'main',
26           driver   => 'Pg',
27           database => 'big_db',
28           host     => 'dbserver.acme.com',
29           username => 'dbadmin',
30           password => 'prodsecret',
31           server_time_zone => 'UTC');
32
33         $registry->add_entry($entry);
34
35         $entry = $registry->entry(domain => 'development', type => 'main');
36
37         $registry->entry_exists(domain => 'foo', type => 'bar'); # false
38
39         $registry->delete_entry(domain => 'development', type => 'main');
40
41         ...
42

DESCRIPTION

44       Rose::DB::Registry objects manage information about Rose::DB data
45       sources.  Each data source has a corresponding
46       Rose::DB::Registry::Entry object that contains its information.  The
47       registry entries are organized in a two-level namespace based on a
48       "domain" and a "type."  See the Rose::DB documentation for more
49       information on data source domains and types.
50
51       Rose::DB::Registry inherits from, and follows the conventions of,
52       Rose::Object.  See the Rose::Object documentation for more information.
53

CONSTRUCTOR

55       new PARAMS
56           Constructs a Rose::DB::Registry object based on PARAMS, where
57           PARAMS are name/value pairs.  Any object method is a valid
58           parameter name.
59

OBJECT METHODS

61       add_entries ENTRY1 [, ENTRY2, ...]
62           Add registry entries.  Each ENTRY must be either a
63           Rose::DB::Registry::Entry-derived object or  reference to a hash of
64           name/value pairs.  The name/value pairs must be valid arguments for
65           Rose::DB::Registry::Entry's constructor.
66
67           Each ENTRY must have a defined domain and type, either in the
68           Rose::DB::Registry::Entry-derived object or in the name/value
69           pairs.  A fatal error will occur if these values are not defined.
70
71           If a registry entry for the specified domain and type already
72           exists, then the new entry will overwrite it.  If you want to know
73           beforehand whether or not an entry exists under a specific domain
74           and type, use the entry_exists method.
75
76           Returns a list (in list context) or reference to an array (in
77           scalar context) of Rose::DB::Registry::Entry objects added.
78
79       add_entry ENTRY
80           Add a registry entry.  ENTRY must be either a
81           Rose::DB::Registry::Entry-derived object or a list of name/value
82           pairs.  The name/value pairs must be valid arguments for
83           Rose::DB::Registry::Entry's constructor.
84
85           The ENTRY must have a defined domain and type, either in the
86           Rose::DB::Registry::Entry-derived object or in the name/value
87           pairs.  A fatal error will occur if these values are not defined.
88
89           If a registry entry for the specified domain and type already
90           exists, then the new entry will overwrite it.  If you want to know
91           beforehand whether or not an entry exists under a specific domain
92           and type, use the entry_exists method.
93
94           Returns the Rose::DB::Registry::Entry object added.
95
96       dump
97           Returns a reference to a hash containing information about all
98           registered data sources.  The hash is structured like this:
99
100               {
101                 domain1 =>
102                 {
103                   type1 =>
104                   {
105                     # Rose::DB::Registry::Entry attributes
106                     # generated by its dump() method
107                     driver   => ...,
108                     database => ...,
109                     host     => ...,
110                     ...
111                   },
112
113                   type2 =>
114                   {
115                     ...
116                   },
117                   ...
118                 },
119
120                 domain2 =>
121                 {
122                   ...
123                 },
124
125                 ...
126               }
127
128           All the registry entry attribute values are copies, not the actual
129           values.
130
131       delete_domain DOMAIN
132           Delete an entire domain, including all the registry entries under
133           that domain.
134
135       delete_entry PARAMS
136           Delete the registry entry specified by PARAMS, where PARAMS must be
137           name/value pairs with defined values for "domain" and "type".  A
138           fatal error will occur if either one is missing or undefined.
139
140           If the specified entry does not exist, undef is returned.
141           Otherwise, the deleted entry is returned.
142
143       entry PARAMS
144           Get the registry entry specified by PARAMS, where PARAMS must be
145           name/value pairs with defined values for "domain" and "type".  A
146           fatal error will occur if either one is missing or undefined.  If
147           the specified entry does not exist, undef is returned.
148
149       entry_exists PARAMS
150           Returns true if the registry entry specified by PARAMS exists,
151           false otherwise.  PARAMS must be name/value pairs with defined
152           values for "domain" and "type".  A fatal error will occur if either
153           one is missing or undefined.
154
155       registered_types DOMAIN
156           Returns a list (in list context) or reference to an array (in
157           scalar context) of the names of all registered types under the
158           domain named DOMAIN.
159
160       registered_domains
161           Returns a list (in list context) or reference to an array (in
162           scalar context) of the names of all registered domains.
163

AUTHOR

165       John C. Siracusa (siracusa@gmail.com)
166

LICENSE

168       Copyright (c) 2010 by John C. Siracusa.  All rights reserved.  This
169       program is free software; you can redistribute it and/or modify it
170       under the same terms as Perl itself.
171
172
173
174perl v5.32.0                      2020-07-28             Rose::DB::Registry(3)
Impressum