Name

File::DataClass::ResultSource - A source of result sets for a given schema

Synopsis

use File::DataClass::Schema;

$schema = File::DataClass::Schema->new
   ( path    => [ qw(path to a file) ],
     result_source_attributes => { source_name => {}, },
     tempdir => [ qw(path to a directory) ] );

$schema->source( q(source_name) )->attributes( [ qw(list of attr names) ] );
$rs = $schema->resultset( q(source_name) );
$result = $rs->find( { name => q(id of field element to find) } );
$result->$attr_name( $some_new_value );
$result->update;
@result = $rs->search( { 'attr name' => q(some value) } );

Description

Provides new result sources for a given schema

Each element in a data file requires a schema definition to define it's attributes

Configuration and Environment

Defines the following attributes

attributes

Array reference of attribute names defined in this result source

defaults

A hash reference of attribute names. The values are the defaults for the result class attributes

name

The name of the result source. Required

label_attr

An attribute name which, if set, is used by the list class to return a list of labels suitable for display purposes

resultset_attributes

A hash reference passed to the result constructor

resultset_class

Classname of the result set

schema

A required weak reference to the schema object that is instantiating this result source

types

A hash reference, keyed by attribute name. The types of the attributes in the result class

Subroutines/Methods

columns

@attributes = $self->columns;

Returns a list of attributes

has_column

$bool = $self->has_column( $attribute_name );

Predicate return true if the attribute exists, false otherwise

resultset

$rs = $self->resultset;

Creates and returns a new File::DataClass::ResultSet object

Diagnostics

None

Dependencies

File::DataClass::ResultSet

Incompatibilities

There are no known incompatibilities in this module

Bugs and Limitations

There are no known bugs in this module. Please report problems to the address below. Patches are welcome

Author

Peter Flanigan, <pjfl@cpan.org>

License and Copyright

Copyright (c) 2017 Peter Flanigan. All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic

This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE