Chemistry-MacroMol

 view release on metacpan or  search on metacpan

Domain.pm  view on Meta::CPAN

    croak "Must specify parent to Chemistry::Domain->new" unless $self->parent;
    return $self;
}


=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.

=cut

sub add_atom {
    my $self = shift;
    $self->add_atom_np(@_); # add atom to self (domain)
    $self->parent->add_atom(@_); # add atom to parent (macromol)
}


=item $domain->add_bond($bond, ...)

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

=cut

sub add_bond {
    my $self = shift;
    $self->add_bond_np(@_); # add bond to self (domain)
    $self->parent->add_bond(@_); # add bond to parent (macromol)
}


1;

=back

=head1 VERSION

0.06

=head1 SEE ALSO

L<Chemistry::MacroMol>, L<Chemistry::Mol>, L<Chemistry::Atom>, 
L<Chemistry::Bond>

=head1 AUTHOR

Ivan Tubert, E<lt>itub@cpan.orgE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright 2004 by Ivan Tubert

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself. 

=cut



( run in 1.725 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )