NAME

CXC::DB::DDL::CloneClear - Provide attribute tags and a method for Moo objects to indicate they should be cloned

VERSION

version 0.18

SYNOPSIS

package Class {
  use Moo;
  with "CXC::DB::DDL::CloneClear';

  has attr1 => ( is => 'rw', default => 'A1', cloneclear => 1 );
  has attr2 => ( is => 'rw', default => 'A2' );
}

my $obj =  Class->new( attr1 => 'B1', attr2 => 'B2' );
my $clone = $obj->clone_simple;

say $clone->attr1; # A1
say $clone->attr2; # B2

METHODS

clone

$clone = $obj->clone;

Clone the object. Uses Clone.

clone_simple

$clone = $obj->clone_simple;

Return a clone of the object without any external constraints or auto increment properties. Primary key constraints remain.

The clear attribute method is run on object attributes which have a cloneclear tag.

SUPPORT

Bugs

Please report any bugs or feature requests to bug-cxc-db-ddl@rt.cpan.org or through the web interface at: https://rt.cpan.org/Public/Dist/Display.html?Name=CXC-DB-DDL

Source

Source is available at

https://gitlab.com/djerius/cxc-db-ddl

and may be cloned from

https://gitlab.com/djerius/cxc-db-ddl.git

SEE ALSO

Please see those modules/websites for more information related to this module.

AUTHOR

Diab Jerius <djerius@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2022 by Smithsonian Astrophysical Observatory.

This is free software, licensed under:

The GNU General Public License, Version 3, June 2007