This is an excerpt from the Grumpy Old Bookman, one of the blogs I regularly keep up with. I like this guy because his thoughts are concise and usually articulate. Here's what he says:
Well now, let's differentiate between the two variations on the theme. Using characters from real life in a novel is one thing; using fictional characters is quite another. But in either case, caution, I would suggest, is strongly advised.
The plain fact is that, if you want to make use of a fictional character, you had better make damn sure that the book(s) in which that character appears are out of copyright. It's no good saying airily, Oh that book was published in the nineteenth century -- it's bound to be out of copyright. Tain't that simple. Would that it were.
If you discover that a poem (or whatever) is in copyright, then you have to find out who owns the copyright. In my experience, letters of enquiry about copyright, which are sent to publishers or agents, can take up to six months, and several promptings, to elicit a reply. And, to continue using Swinburne as an example, it can turn out that no one knows the answer to your query.
I've always been fascinated by historical fiction - taking characters from the past and placing them in another situation just to see how they react. I think most fiction writers have an innate desire to ask, "But what if this happened instead?"