Chemistry-MacroMol

 view release on metacpan or  search on metacpan

Domain.pm  view on Meta::CPAN


$VERSION = '0.06';
# $Id: Domain.pm,v 1.6 2004/07/03 19:19:44 itubert Exp $


use 5.006;
use strict;
use warnings;
use base qw(Chemistry::Mol);
use Carp;
use Scalar::Util 'weaken';

=head1 NAME

Chemistry::Domain - Class for domains in macromolecules

=head1 SYNOPSIS

  use Chemistry::Domain;
  my $domain = Chemistry::Domain->new(parent => $bigmol);

Domain.pm  view on Meta::CPAN

=item $domain->parent

Returns the parent of the domain.

=cut

sub parent {
    my $self = shift;
    if (@_) {
        $self->{parent} = shift;
        weaken($self->{parent});
        return $self;
    } else {
        return $self->{parent};
    }
}

=item $domain->add_atom($atom, ...)

Add one or more Atom objects to the domain. Returns the last atom added. It 
also automatically adds the atoms to the atom table of the parent molecule.



( run in 0.357 second using v1.01-cache-2.11-cpan-65fba6d93b7 )