I believe the right approach is to have a method in X that validates whatever is to validate in X. If you can make that method generic, so that it would work for A and B too, even better
Any subclasses for which X->validate does everything that is to do are finished now. Any subclass that has to do something more would have their own validate method. That method would then call the validate method of the superclass ($self->SUPER::validate) and if that returns ok, validate the additional stuff of the subclass.
As you can see, you probably need a validate method in A and in B, BUT you don't need to write any code twice.