Valence-shell photoabsorption by CO2 and its connections with electron-CO2 scattering