I feel like I have eardrum perforation. Is it safe to shower with it? Or even safe to shower with middle ear infections?

See doctor. You can take shower as hardly any water enters middle ear - both in middle ear infection and in ear drum perforation .But important is to get checked up by your doctor if you have any ear drum perforation or not and also if there is any drainage or middle ear infection which should be treated.
Safe but. Under normal conditions the surface tension of water prevents it from entering the middle ear thru a small perforation. However, when bathing soap reduces the surface tension and may make it easier for water to enter the middle ear. For that reason it's often recommended to use a shower cap to cover the ears or use an ear plug or cotton with petroleum jelly.
It's ok to shower. Realize that kids who have "ear tubes" to prevent recurrent middle ear infections actually have a plastic tube in each ear drum to maintain a "hole" in each ear drum. Doctors tell those kids not to dive underwater. Some of those kids use ear plugs even if swimming with their heads above water... which means one could use ear plugs in the shower too. Just don't purposely spray water into the ears.