NAME

UR::Namespace - Manage collections of packages and classes

SYNOPSIS

In a file called MyApp.pm:

use UR;
UR::Object::Type->define(
    class_name => 'MyApp',
    is => 'UR::Namespace',
);

Other programs, as well as modules in the MyApp subdirectory can now put

use MyApp;

in their code, and they will have access to all the classes and data under the MyApp tree.

DESCRIPTION

A UR namespace is the top-level object that represents your data's class structure in the most general way. After use-ing a namespace module, the program gets access to the module autoloader, which will automatically use modules on your behalf if you attempt to interact with their packages in a UR-y way, such as calling get().

Most programs will not interact with the Namespace, except to use its package.

Methods

get_material_classes
my @class_metas = $namespace->get_material_classes();

Return a list of UR::Object::Type class metadata object that exist in the given Namespace. Note that this uses File::Find to find *.pm files under the Namespace directory and 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.

get_material_class_names
my @class_names = $namespace->get_material_class_names()

Return just the names of the classes produced by get_material_classes.

get_data_sources
my @data_sources = $namespace->get_data_sources()

Return the data source objects it finds defined under the DataSource subdirectory of the namespace.

get_base_directory_name
my $path = $namespace->get_base_directory_name()

Returns the directory path where the Namespace module was loaded from.

SEE ALSO

UR::Object::Type, UR::DataSource, UR::Context