package RDAS::RDAS;

use Carp;

use lib '/app/tools/common/lib';
use base 'Common::XMLObject';

sub _init {
    my $self = shift;
    my %args = @_;

    foreach my $field ( $self->_validOptions() ) {
        $self->{"_$field"} = $args{$field} if ( defined( $args{$field} ) );
    }

    return $self;
}

sub AUTOLOAD {
    my $self           = shift;
    my $fieldSpecifier = $AUTOLOAD;
    $fieldSpecifier =~ s/.*://;    # Strips fully-qualified portion.

    return if 'DESTROY' eq $fieldSpecifier;

    confess("no reference") if ( !ref($self) );

    unless ( grep( /^$fieldSpecifier$/, $self->_validOptions() ) ) {
        confess "unknown property/method \"$fieldSpecifier\"";
    }

    return $self->{"_$fieldSpecifier"};
}

sub _validOptions { confess "Must be overloaded" }

1;
