I slipped a cog and called Geoghegan's "Ten Thousand Miles Away" a variant on Carryl's poem; the reverse is true. Geoghegan died in 1889; an unattributed copy in the Bodleian Library is dated 1840-1866 (Harding B11(3763)), posted in thread 62524, linked at the top of this thread.
This song caught on with sailors and is included in Hugill's "Shanties from the Seven Seas."