Take a peek at Filter::Indent::HereDoc, it does exactly what you need.
In reply to Re: Indented HEREDOC? by vek in thread Indented HEREDOC? by Withigo