exoplanets.pl   exoplanets.pl 
skipping to change at line 37 skipping to change at line 37
use DBI(); use DBI();
use LWP::UserAgent(); use LWP::UserAgent();
# #
# Stage 1: connect to 'The Extrasolar Planets Encyclopaedia' at exoplanet.e u, fetch CSV data and store to MySQL # Stage 1: connect to 'The Extrasolar Planets Encyclopaedia' at exoplanet.e u, fetch CSV data and store to MySQL
# Stage 2: read MySQL catalog of exoplanets and store it to JSON # Stage 2: read MySQL catalog of exoplanets and store it to JSON
# #
$URL = "http://exoplanet.eu/catalog/csv/"; $URL = "http://exoplanet.eu/catalog/csv/";
$CSV = "./exoplanets.csv"; $CSV = "./exoplanets.csv";
$HCSV = "./";
$JSON = "./exoplanets.json"; $JSON = "./exoplanets.json";
$CATALOG_FORMAT_VERSION = 1; $CATALOG_FORMAT_VERSION = 1;
$dbname = "exoplanets"; $dbname = "exoplanets";
$dbhost = "localhost"; $dbhost = "localhost";
$dbuser = "exoplanet"; $dbuser = "exoplanet";
$dbpass = "exoplanet"; $dbpass = "exoplanet";
$UA = LWP::UserAgent->new(keep_alive => 1, timeout => 360); $UA = LWP::UserAgent->new(keep_alive => 1, timeout => 360);
$UA->agent("Mozilla/5.0 (Stellarium Exoplanets Catalog Updater 0.2; http:// stellarium.org/)"); $UA->agent("Mozilla/5.0 (Stellarium Exoplanets Catalog Updater 0.4; http:// stellarium.org/)");
$request = HTTP::Request->new('GET', $URL); $request = HTTP::Request->new('GET', $URL);
$responce = $UA->request($request); $responce = $UA->request($request);
if ($responce->is_success) { if ($responce->is_success) {
open(OUT, ">$CSV"); open(OUT, ">$CSV");
$data = $responce->content; $data = $responce->content;
binmode OUT; binmode OUT;
print OUT $data; print OUT $data;
close OUT; close OUT;
} else { } else {
skipping to change at line 150 skipping to change at line 151
$sname =~ s/^sigma/σ/gi; $sname =~ s/^sigma/σ/gi;
$sname =~ s/^tau/τ/gi; $sname =~ s/^tau/τ/gi;
$sname =~ s/^upsilon/υ/gi; $sname =~ s/^upsilon/υ/gi;
$sname =~ s/^ups/υ/gi; $sname =~ s/^ups/υ/gi;
$sname =~ s/^phi/φ/gi; $sname =~ s/^phi/φ/gi;
$sname =~ s/^chi/χ/gi; $sname =~ s/^chi/χ/gi;
$sname =~ s/^psi/ψ/gi; $sname =~ s/^psi/ψ/gi;
$sname =~ s/^omega/ω/gi; $sname =~ s/^omega/ω/gi;
$sname =~ s/^ome/ω/gi; $sname =~ s/^ome/ω/gi;
if (($sRA ne '00:00:00.0') && ($sDec ne '+00:00:00.0')) { if (($sRA ne '00:00:00.0') && ($sDec ne '+00:00:00.0') && ($sname ne '')) {
# check star # check star
$sth = $dbh->prepare(q{SELECT sid FROM stars WHERE ra_coord= ? AND dec_coord=?}); $sth = $dbh->prepare(q{SELECT sid FROM stars WHERE ra_coord= ? AND dec_coord=?});
$sth->execute($outRA, $outDE); $sth->execute($outRA, $outDE);
@starDATA = $sth->fetchrow_array(); @starDATA = $sth->fetchrow_array();
# get star ID # get star ID
if (scalar(@starDATA)!=0) { if (scalar(@starDATA)!=0) {
$starID = @starDATA[0]; $starID = @starDATA[0];
} else { } else {
# insert star data # insert star data
$sth = $dbh->do(q{INSERT INTO stars (ra_coord,dec_co ord,sname,distance,stype,smass,smetal,vmag,sradius,sefftemp) VALUES (?,?,?, ?,?,?,?,?,?,?)}, undef, $outRA, $outDE, $sname, $sdist, $sstype, $smass, $s metal, $sVmag, $sradius, $sefftemp); $sth = $dbh->do(q{INSERT INTO stars (ra_coord,dec_co ord,sname,distance,stype,smass,smetal,vmag,sradius,sefftemp) VALUES (?,?,?, ?,?,?,?,?,?,?)}, undef, $outRA, $outDE, $sname, $sdist, $sstype, $smass, $s metal, $sVmag, $sradius, $sefftemp);
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/