| CatalystX-Usul documentation | Contained in the CatalystX-Usul distribution. |
CatalystX::Usul::File::Schema - Base class for schema definitions
0.3.$Revision: 576 $
package CatalystX::Usul::File::ResultSource;
use parent qw(CatalystX::Usul);
use CatalystX::Usul::File::Schema;
use Class::C3;
use Scalar::Util qw(weaken);
__PACKAGE__->config( schema_class => q(CatalystX::Usul::File::Schema) );
__PACKAGE__->mk_accessors( qw(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 ) );
weaken( $new->schema->{source} );
return $new;
}
This is the base class for schema definitions. Each element in a data file requires a schema definition to define it's attributes that should inherit from this
Creates a new instance of the storage class which defaults to CatalystX::Usul::File::Storage
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: Schema.pm 576 2009-06-09 23:23:46Z pjf $ package CatalystX::Usul::File::Schema; 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::Storage; use Class::C3; use Scalar::Util qw(weaken); __PACKAGE__->config ( attributes => [], defaults => {}, element => q(unknown), storage_class => q(CatalystX::Usul::File::Storage), ); __PACKAGE__->mk_accessors( qw(attributes defaults element label_attr lang_dep source storage storage_class) ); sub new { my ($self, $app, $attrs) = @_; my $new = $self->next::method( $app, $attrs ); weaken( $new->{source} ); $attrs = { %{ $attrs->{storage_attributes} || {} }, schema => $new }; $new->storage( $new->storage_class->new( $app, $attrs ) ); return $new; } 1; __END__
# Local Variables: # mode: perl # tab-width: 3 # End: