Just a thought: you could insert a 'IF NOT EXISTS'-create just before the TRUNCATE-statement so that the program 'Just Works' if the table isn't there.
$dbh->do("
CREATE TABLE IF NOT EXISTS geoip
(
netblock cidr NOT NULL,
country_code text NOT NULL,
country_name text NOT NULL,
CONSTRAINT geoip_pk PRIMARY KEY (netblock)
);" ) or die($dbh->errstr);
IF NOT EXISTS was added to CREATE TABLE long ago and all supported versions of postgres support it.
(I removed the oids- and tablespace-stuff, as I didn't need that.)