UR::Namespace(3pm)
π UR::Namespace β manage collections of packages and classes π
okay bestie, welcome to the UR::Namespace page from the User Contributed Perl Documentation, and let me tell you, this one is lowkey iconic. it's the vibe check for your whole class tree. let's get into it β¨
πΈ NAME πΈ
UR::Namespace β manage collections of packages and classes. that's it, that's the whole job, and it does it beautifully. π
π¦ SYNOPSIS π¦
so you're gonna make a file called MyApp.pm, and in it you write:
use UR;
UR::Object::Type->define(
class_name => 'MyApp',
is => 'UR::Namespace',
);
and then, like, every other program β plus all the modules chillin' in the MyApp subdirectory β can now just drop
use MyApp;
into their code, and boom π₯ they've got access to all the classes and all the data under the MyApp tree. it's giving main character energy fr fr.
β¨ DESCRIPTION β¨
a UR namespace is the top-level object that represents your data's class structure in the most general way possible. it's the CEO of your package hierarchy. π
so after you use a namespace module, your program gets access to the module autoloader, and the autoloader will automatically use modules on your behalf whenever you try to interact with their packages in a UR-y way β like calling get(), for example. it just knows. no cap. πͺ
most programs will not interact with the Namespace at all, except to use its package. so if you're out here stressing about it, don't β you're fine, bestie. π«Ά
π Methods π
π get_material_classes
my @class_metas = $namespace->get_material_classes();
returns a list of UR::Object::Type class metadata objects that exist in the given Namespace. okay so heads up: this uses File::Find to find *.pm files under the Namespace directory, and then it calls UR::Object::Type->get($name) for each package name to get the autoloader to use the package.
β οΈ it's likely to be pretty slow. like, we're not kidding. plan accordingly, okay? π
π get_material_class_names
my @class_names = $namespace->get_material_class_names()
returns just the names of the classes produced by get_material_classes. the names only. no extras. minimal. clean. slay. β¨
π get_data_sources
my @data_sources = $namespace->get_data_sources()
returns the data source objects it finds defined under the DataSource subdirectory of the namespace. that's the whole thing. simple, gorgeous, does what it says. π
π§ get_base_directory_name
my $path = $namespace->get_base_directory_name()
returns the directory path where the Namespace module was loaded from. so like, where it lives. its home. its little apartment. π
π SEE ALSO π
UR::Object::Type, UR::DataSource, UR::Context β go read those next bestie, they're all part of the same squad. π«Ά
and that's the page!! written for perl v5.32.1, dated 2022-01-17, mwah π thanks for reading, you ate this whole manpage, periodt. πβ¨
π¦ where this page comes from
- debian bookworm: libur-perl 0.470+ds-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libur-perl 0.470+ds-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libur-perl 0.470+ds-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms