package Object::Inline;

use strictures 1;
use Package::Variant ();
use Import::Into;

sub import {
  my $class = shift;
  my $target = caller;
  Package::Variant->import::into(
    $target,
    no_import => 1, make_variant => sub { $_[2]->($_[1]) },
    @_,
  );
  no strict 'refs';
  *{"${target}::object"} = sub (&;@) {
    my $code = shift;
    Package::Variant->build_variant_of($target, $code)->new(@_);
  };
}

1;
