| CatalystX-Usul documentation | Contained in the CatalystX-Usul distribution. |
CatalystX::Usul::File::ResultSource - A source of result sets for a given schema
0.3.$Revision: 576 $
use CatalystX::Usul::File;
$attrs = { schema_attributes => { ... } };
$result_source = CatalystX::Usul::File->new( $app, $attrs );
$result_source->resultset( $file, $lang );
Provides new result sets for a given schema. Ideas robbed from DBIx::Class
Constructor's arguments are the application object and a hash ref of schema attributes. Creates a new instance of the schema class which defaults to CatalystX::Usul::File::Schema
Sets the schema's file and lang attributes from the optional parameters. Creates and returns a new CatalystX::Usul::File::Resultset object
Returns the storage handle for the current schema
None
None
There are no known incompatibilities in this module
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Peter Flanigan, <Support at RoxSoft.co.uk>
Copyright (c) 2008 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
| CatalystX-Usul documentation | Contained in the CatalystX-Usul distribution. |
# @(#)$Id: ResultSource.pm 576 2009-06-09 23:23:46Z pjf $ package CatalystX::Usul::File::ResultSource; use strict; use warnings; use version; our $VERSION = qv( sprintf '0.3.%d', q$Rev: 576 $ =~ /\d+/gmx ); use parent qw(CatalystX::Usul); use CatalystX::Usul::File::ResultSet; use CatalystX::Usul::File::Schema; use Class::C3; __PACKAGE__->config ( resultset_attributes => {}, resultset_class => q(CatalystX::Usul::File::ResultSet), schema_class => q(CatalystX::Usul::File::Schema) ); __PACKAGE__->mk_accessors( qw(resultset_attributes resultset_class schema schema_class) ); sub new { my ($self, $app, $attrs) = @_; my $new = $self->next::method( $app, $attrs ); $attrs = { %{ $attrs->{schema_attributes} || {} }, source => $new }; $new->schema( $new->schema_class->new( $app, $attrs ) ); return $new; } sub resultset { my ($self, $path, $lang) = @_; $self->storage->path( $path ) if ($path); $self->storage->lang( $lang ) if ($lang); return $self->resultset_class->new( $self, $self->resultset_attributes ); } sub storage { return shift->schema->storage; } 1; __END__
# Local Variables: # mode: perl # tab-width: 3 # End: