Long barrels are only an advantage for as long as the propellant is burning (not long). After this they just slow the projectile down with the extra friction.
Oh and gas pipe? A moderate rifle charge can produce 60,000 psi, imagine what that would do to gas pipe.