in reply to How do you say, in Perl....

The general notion of “wrapping things,” ... the so-called “onion approach” ... might be the sort of thing that you are looking for.   As an example of the idea, look at Plack::Builder, which is part of a so-called “web server super-glue” system that needs a lot of flexibility.   (Nevermind the system.   Observe the concept and its implementation.   By the way, “DSL” means “domain-specific language,” which was a new terminology to me.)

Before pursuing strategies like, “I wish to write a generic module that will take a hash reference as a parameter ...” it is usually wisdom to initially restrain such thoughts and let your CPAN do the walking before you let your fingers do the typing.   Presume that you will probably be able to find something that is suitable without having to build it.   Not always the case, but usually a fruitful way ... in my experience, a much more fruitful way ... to arrange your initial thoughts regarding a problem like this one.   Or I think so, anyway...

(And if you do come up with something original and stunning ... “Wow!   Your first CPAN contribution!   Gee, thanks!!”   Lookin’ forward to it ... seriously.)