Rose::...gistry(3pm)

✨ Rose::DB::Registry ✨

Rose::DB::Registry β€” bestie, it's literally the data source registry πŸ’… (it's the Rose::DB::Registry page from the User Contributed Perl Documentation, and it's giving organized).


🌸 SYNOPSIS 🌸

okay so here's the whole vibe in code form, no notes:

use Rose::DB::Registry;

$registry = Rose::DB::Registry->new;

$registry->add_entry(
  domain   => 'development',
  type     => 'main',
  driver   => 'Pg',
  database => 'dev_db',
  host     => 'localhost',
  username => 'devuser',
  password => 'mysecret',
  server_time_zone => 'UTC');

$entry = Rose::DB::Registry::Entry->new(
  domain   => 'production',
  type     => 'main',
  driver   => 'Pg',
  database => 'big_db',
  host     => 'dbserver.acme.com',
  username => 'dbadmin',
  password => 'prodsecret',
  server_time_zone => 'UTC');

$registry->add_entry($entry);

$entry = $registry->entry(domain => 'development', type => 'main');

$registry->entry_exists(domain => 'foo', type => 'bar'); # false

$registry->delete_entry(domain => 'development', type => 'main');

...

πŸ¦‹ DESCRIPTION πŸ¦‹

So. Rose::DB::Registry objects keep track of info about your Rose::DB data sources πŸ’–. Every single data source gets its own little Rose::DB::Registry::Entry object holding its info, and all those entries live in a two-level namespace based on a "domain" and a "type." Need the deets on data source domains and types? Go read the Rose::DB documentation, it's all there 🫢.

Also important: Rose::DB::Registry inherits from, and follows the conventions of, Rose::Object. So if you wanna know more, the Rose::Object documentation is right there ✨.


πŸŽ€ CONSTRUCTOR πŸŽ€

  • new PARAMS β€” builds a Rose::DB::Registry object out of PARAMS, where PARAMS are name/value pairs. And get this: any object method is a valid parameter name πŸ‘‘.

πŸ’… OBJECT METHODS πŸ’…

  • add_entries ENTRY1 [, ENTRY2, ...] β€” adds a bunch of registry entries at once, iconic. Each ENTRY has to be either a Rose::DB::Registry::Entry-derived object or a reference to a hash of name/value pairs. Those name/value pairs must be valid arguments for Rose::DB::Registry::Entry's constructor.

Every ENTRY needs a defined domain and type β€” either inside the Rose::DB::Registry::Entry-derived object or in the name/value pairs. If those values aren't defined? πŸ’€ fatal error, bestie, no cap.

And if a registry entry for that domain and type already exists, the new entry overwrites it. Want to know beforehand whether something already lives under a specific domain and type? Use entry_exists, easy.

Returns a list (in list context) or a reference to an array (in scalar context) of the Rose::DB::Registry::Entry objects added πŸ“.

  • add_entry ENTRY β€” adds one registry entry, the low-key version. ENTRY must be either a Rose::DB::Registry::Entry-derived object or a list of name/value pairs. Those name/value pairs must be valid arguments for Rose::DB::Registry::Entry's constructor.

The ENTRY must have a defined domain and type, either in the Rose::DB::Registry::Entry-derived object or in the name/value pairs. Not defined? Fatal error 😭.

Already got an entry for that domain and type? The new one overwrites it. If you wanna check first, entry_exists is your girl.

Returns the Rose::DB::Registry::Entry object added πŸ’–.

  • dump β€” hands you back a reference to a hash with info about all the registered data sources. The hash is shaped like this:
{
  domain1 =>
  {
    type1 =>
    {
      # Rose::DB::Registry::Entry attributes
      # generated by its dump() method
      driver   => ...,
      database => ...,
      host     => ...,
      ...
    },

    type2 =>
    {
      ...
    },
    ...
  },

  domain2 =>
  {
    ...
  },

  ...
}

Heads up though: every registry entry attribute value in there is a copy, not the actual value. Don't go mutating and expecting it to stick πŸ™ˆ.

  • delete_domain DOMAIN β€” deletes a whole entire domain, and every registry entry hanging out under it. Total main character move.
  • delete_entry PARAMS β€” deletes the registry entry specified by PARAMS, where PARAMS must be name/value pairs with defined values for "domain" and "type". Missing or undefined? Fatal error, obviously.

If that entry doesn't exist, undef comes back. Otherwise you get the deleted entry returned πŸŽ€.

  • entry PARAMS β€” grabs the registry entry specified by PARAMS, where PARAMS must be name/value pairs with defined values for "domain" and "type". Either one missing or undefined = fatal error. And if the entry doesn't exist, you get undef back, sorry babe 🌸.
  • entry_exists PARAMS β€” returns true if the registry entry specified by PARAMS exists, false otherwise. PARAMS must be name/value pairs with defined values for "domain" and "type". Missing or undefined β†’ fatal error πŸ‘‘.
  • registered_types DOMAIN β€” returns a list (in list context) or a reference to an array (in scalar context) of the names of all the registered types under the domain named DOMAIN ⭐.
  • registered_domains β€” returns a list (in list context) or a reference to an array (in scalar context) of the names of all registered domains 🌈.

🌟 AUTHOR 🌟

John C. Siracusa (siracusa@gmail.com) β€” the legend himself πŸ’œ


πŸ“œ LICENSE πŸ“œ

Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


and that's the whole page, bestie, periodt πŸ’…βœ¨

this was Rose::DB::Registry, perl v5.40.1, dated 2026-07-31 β€” ugh, obsessed, fr fr πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from