---
name: "MooX::Rebuild"
section: "3pm"
platform: "linux"
package: "libmoox-buildargs-perl"
version: "0.08-4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/MooX::Rebuild"
---

# MooX::Rebuild(3pm)

Rebuild your Moo objects.

## NAME

MooX::Rebuild - Rebuild your Moo objects.

## SYNOPSIS

```
    package Foo;
    use Moo;
    with 'MooX::Rebuild';
    has get_bar => (
        is       => 'ro',
        init_arg => 'bar',
    );

    my $foo1 = Foo->new( bar => 'lala' );
    my $foo2 = $foo1->rebuild();
    print $foo2->get_bar(); # lala
```

## DESCRIPTION

Make copies of Moo objects using the same arguments used to create the original objects.

This Moo role depends on, and uses, the MooX::BuildArgs role in order to capture the original arguments used to create an object.

## METHODS

### rebuild

```
    my $clone   = $object->rebuild();
    my $similar = $object->rebuild( %extra_args );
```

Creates a new instance in the same class as the source object and using the same arguments used to make the source object.

## SEE ALSO

- •

  MooX::BuildArgs

- •

  MooX::BuildArgsHooks

- •

  MooX::MethodProxyArgs

- •

  MooX::SingleArg

## SUPPORT

See "SUPPORT" in MooX::BuildArgs.

## AUTHORS

See "AUTHORS" in MooX::BuildArgs.

## LICENSE

See "LICENSE" in MooX::BuildArgs.
