| UR::DataSource::File(3pm) | User Contributed Perl Documentation | UR::DataSource::File(3pm) |
UR::DataSource::File - Parent class for file-based data sources
This module is deprecated. Use UR::DataSource::Filesystem instead.
package MyNamespace::DataSource::MyFile;
class MyNamespace::DataSource::MyFile {
is => ['UR::DataSource::File', 'UR::Singleton'],
};
sub server { '/path/to/file' }
sub delimiter { "\t" }
sub column_order { ['thing_id', 'thing_name', 'thing_color' ] }
sub sort_order { ['thing_id'] }
package main;
class MyNamespace::Thing {
id_by => 'thing_id',
has => [ 'thing_id', 'thing_name', 'thing_color' ],
data_source => 'MyNamespace::DataSource::MyFile',
}
my @objs = MyNamespace::Thing->get(thing_name => 'Bob');
Classes which wish to retrieve their data from a regular file can use a UR::DataSource::File-based data source. The modules implementing these data sources live under the DataSource subdirectory of the application's Namespace, by convention. Besides defining a class for your data source inheriting from UR::DataSource::File, it should have the following methods, either as properties or functions in the package.
These methods determine the configuration for your data source.
You must have either server() or file_list() in your module, but not both. The existence of server() takes precedence over file_list().
UR::DataSource
UR, UR::DataSource
| 2022-01-17 | perl v5.32.1 |