Closed operatorofhell closed 8 years ago
It looks like there might be two or three Moosey ways to fix this. I'm not sure if either are actually correct but so far the one I've tried does not seem to work so maybe option 2 would be better.
The problem is that _order is not being set when we create a FailoverPeer with new(). In order to work around this we can
make a BUILD sub (pretty straightforward but seems yucky)
make a builder for _order that sets order variables based on if $self->
sub _build_order {
my $self = shift;
map { defined($self->$_) ? $_ : undef } keys %{$self->arguments};
}
Although this doesn't work because when _order calls it's builder apparently arguments hasn't been built yet.
set a trigger in the has clause for all the variables that calls a sub to push their name into _order. This seems clean. It means we can also remove the push from the slurp part because this takes care of it for us.
Of course, it's never that simple..
http://stackoverflow.com/questions/22306330/moose-trigger-caller
So we picked up a new dep but I think this should fix it properly.
Here is a test regarding the Issue https://github.com/jhthorsen/net-isc-dhcpd/issues/21. I hope it clarifies what I want to do.