add perl version composite pattern