return $result;
}
+sub clone_or_self {
+ my ($self) = @_;
+ (ref $self)->new(
+ service => $self->service->clone_or_self,
+ curried => [ @{$self->curried} ],
+ );
+}
+
1;
}
}
+# This assumes that by default either services are not stateful
+# or do want to have persistent state. It's notably overriden by Router.
+
+sub clone_or_self { $_[0] }
+
1;
delete $self->services->{$name}
}
-sub clone {
+sub clone_or_self {
my ($self) = @_;
- my $new = (ref $self)->new(services => $self->services);
- $new->register(meta => Tak::MetaService->new(router => $new));
- $new;
+ (ref $self)->new(services => { %{$self->services} });
}
1;
has service => (is => 'ro', required => 1, weak_ref => 1);
+sub clone_or_self {
+ my ($self) = @_;
+ my $new = $self->service->clone_or_self;
+ ($new ne $self->service
+ ? 'Tak::Client'
+ : ref($self))->new(service => $new, curried => [ @{$self->curried} ]);
+}
+
+
1;