How can I create, without a verbatim environment, these nice boxes that the Fancyvrb package produces:

The sibling package Fancybox (by the same author) doesn't allow for the caption being placed onto the box's sides.
|
Using @GonzaloMedina's code (here), and @egreg's suggestion, the desired code is the following:
It produces the following PDF (cropped here):
|
|||
|
|
mdframed– egreg Oct 10 '12 at 15:46