We present a perturbative QCD based model for vacuum and in-medium hadronization. The effects of induced energy loss and nuclear absorption have been included. The main objective is the determination of the relative contribution of these mechanisms to the multiplicity ratio observable, measured in semi-inclusive deep-inelastic scattering off deuterium and nuclear targets. This is directly related to the determination of the production length, $Lp$, necessary for a quark to turn into a prehadron. We compare our results with HERMES data for multiplicity ratio and $p_t$-broadening, and show that the description of the whole data set, keeping the model parameters fixed, puts strong constrains on $Lp$. Contrary to induced-energy-loss based models, we find an important contribution from nuclear absorption at HERMES energies. Finally, we discuss some consequences of our study for the LHC physics, and we present the model predictions for the future EIC experiment.