Phineas and Ferb the Movie: Across the 2nd Dimension (2011)

Perry's worst fear comes true when Phineas and Ferb finds out that he is in fact Secret Agent P, but that soon pales in comparison during a trip to the 2nd dimension where Perry finds out that Dr. Doofenshmirtz is truly evil and successful.