A shashlik calorimeter with longitudinal segmentation for a linear collider