CatalystX::Usul::File::Schema - Base class for schema definitions


CatalystX-Usul documentation Contained in the CatalystX-Usul distribution.

Index


Code Index:

Name

Top

CatalystX::Usul::File::Schema - Base class for schema definitions

Version

Top

0.3.$Revision: 576 $

Synopsis

Top

   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;
   }

Description

Top

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

Subroutines/Methods

Top

new

Creates a new instance of the storage class which defaults to CatalystX::Usul::File::Storage

Diagnostics

Top

None

Configuration and Environment

Top

None

Dependencies

Top

CatalystX::Usul
CatalystX::Usul::File::ResultSet
CatalystX::Usul::File::Storage
Scalar::Util

Incompatibilities

Top

There are no known incompatibilities in this module

Bugs and Limitations

Top

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

Author

Top

Peter Flanigan, <Support at RoxSoft.co.uk>

License and Copyright

Top


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: