Can a beamer frame have both [containsverbatim] and hidden/shown block options? [duplicate]

Possible Duplicate:
\pause won't generate extra slides in a containsverbatim frame

I use lstlisting environments in my beamer frames, but I would also like to have blocks with showing/hidden options like <2>, <1-3>, etc. With the following code, only the first version of the frame is displayed (with only the first block). Is there a way to make the hidden/shown block options work when the [containsverbatim] option is active?

\begin{frame}[containsverbatim]

\begin{block}{}
\begin{lstlisting}
blah blah blah
\end{lstlisting}
\end{block}

\begin{block}<2>{}
\begin{lstlisting}
blah blah blah
\end{lstlisting}
\end{block}

\end{frame}

-
 Please do not use containsverbatim: it is a historical overhang and is not in the documentation for a reason. The correct option is fragile. – Joseph Wright♦ Aug 28 '12 at 19:09

marked as duplicate by Daniel, Tom Bombadil, Marco Daniel, percusse, cgniederAug 29 '12 at 16:06

Of course you can combine verbatim material and overlay specifications in your frames; only some precautions must be taken: to use verbatim material in a frame, you have to add the option [fragile] to the frame environment (with verbatim material, the \frame command will not do); the \end{frame} line must be alone on a single line:

\documentclass{beamer}
\usepackage{listings}

\begin{document}

\begin{frame}[fragile]
\begin{block}{}
\begin{lstlisting}
blah blah blah
\end{lstlisting}
\end{block}

\begin{block}<2>{}
\begin{lstlisting}
blah blah blah
\end{lstlisting}
\end{block}
\end{frame}

\end{document}

-
 Thanks for the info about containsverbatim vs fragile. But how come I can't even indent \end{frame} when using fragile? I've always indented my LaTeX code (like any other code) and it would be hard for me to live without indentation... How can I do that? – Eusebius Aug 29 '12 at 7:15 I'll choose this answer, but IMO the situation is bugged, if "fragile" works only if no space or tabulation is used on a given LaTeX line. – Eusebius Sep 1 '12 at 7:09

You can combine lstlisting and beamer's uncover features. However you should not use containsverbatim. Instead there is an option to place the verbatim part before the \begin{frame} where it will not confuse the beamer features. You can find it in the documentation of the beamer class.

-
 It would be great if you can make a minimal example using the OP's snippet to demonstrate how your answer works. – percusse Aug 28 '12 at 18:56