$ ./4.triton.pl ./4.triton.pl: line 1: use: command not found ./4.triton.pl: line 2: use: command not found ./4.triton.pl: line 3: use: command not found ./4.triton.pl: line 4: use: command not found ./4.triton.pl: line 5: use: command not found ./4.triton.pl: line 6: use: command not found ./4.triton.pl: line 7: use: command not found ./4.triton.pl: line 8: use: command not found ./4.triton.pl: line 9: use: command not found ./4.triton.pl: line 10: use: command not found ./4.triton.pl: line 14: syntax error near unexpected token `$moon_seconds,' ./4.triton.pl: line 14: `my ( $moon_seconds, $sun_seconds, $equal_sec, $equal );' $ file * 1.manifest: ASCII text 1.oneify.bash: Bourne-Again shell script, ASCII text executable 2.a.pl: Perl script text executable 2.create.bash: Bourne-Again shell script, ASCII text executable 3: empty 30: empty 3.ping3a.pl: Perl script text executable 4.haukex.pl: Perl script text executable 4.ping3a.pl: Perl script text executable 4.triton.pl: ASCII text 5.ping3a.pl: Perl script text executable template_stuff: directory :utf8: empty utils1.pm: Perl5 module source, UTF-8 Unicode text $ #### use warnings; use strict; use 5.010; use WWW::Mechanize::GZip; use HTML::TableExtract; use Prompt::Timeout; use open ':std', OUT => ':utf8'; use constant TIMEOUT => 3; use constant MAXTRIES => 30; use utils1; ## redesign for solar eclipse of aug 21, 2017 # declarations, initializations to precede main control my ( $moon_seconds, $sun_seconds, $equal_sec, $equal ); #### WWW::Mechanize::GZip HTML::TableExtract Prompt::Timeout #### $ ./5.triton.pl Make query number 1? [Y] :Y Make query number 2? [Y] :Y Make query number 3? [Y] :Y Make query number 4? [Y] :Y Make query number 5? [Y] :Y Make query number 6? [Y] :Y $VAR1 = [ [ ' ', 'Right Ascension', 'Declination', 'Distance (AU)', 'From 45°N 122°W:', undef, undef ], [ undef, undef, undef, undef, 'Altitude', 'Azimuth', undef ], [ 'Sun', '15h 14m 28s', "\x{2212}18\x{b0} 1.0'", '0.990', "\x{2212}56.049", '134.597', 'Set' ], [ 'Mercury', '16h 34m 17s', "\x{2212}24\x{b0} 23.1'", '1.215', "\x{2212}48.583", '104.536', 'Set' ], [ 'Venus', '14h 21m 15s', "\x{2212}12\x{b0} 43.1'", '1.642', "\x{2212}56.283", '159.644', 'Set' ], [ 'Moon', '11h 29m 54s', '+6° 4.0\'', '59.6 ER', "\x{2212}31.689", "\x{2212}142.465", 'Set' ], [ 'Mars', '12h 51m 38s', "\x{2212}4\x{b0} 19.7'", '2.331', "\x{2212}48.205", "\x{2212}163.434", 'Set' ], [ 'Jupiter', '14h 21m 15s', "\x{2212}12\x{b0} 59.9'", '6.395', "\x{2212}56.553", '159.518', 'Set' ], [ 'Saturn', '17h 41m 55s', "\x{2212}22\x{b0} 24.3'", '10.861', "\x{2212}35.493", '92.927', 'Set' ], [ 'Uranus', '1h 35m 39s', '+9° 19.7\'', '19.010', '54.328', "\x{2212}0.031", 'Up' ], [ 'Neptune', '22h 53m 7s', "\x{2212}8\x{b0} 6.8'", '29.586', '25.569', '45.596', 'Up' ], [ 'Pluto', '19h 13m 54s', "\x{2212}21\x{b0} 48.5'", '33.987', "\x{2212}18.947", '77.750', 'Set' ] ]; $ #### $ cat 2.jv.txt Script executed at Thu Jan 3 09:23:32 2019 1 Venus 14h 22m 7s −12° 47.7' 1.642 −35.087 −108.646 Set 1 Jupiter 14h 21m 24s −13° 0.6' 6.394 −35.123 −108.310 Set 2 Venus 14h 20m 55s −12° 41.4' 1.642 −45.439 124.939 Set 2 Jupiter 14h 21m 11s −12° 59.6' 6.395 −45.644 124.606 Set 3 Venus 14h 21m 33s −12° 44.7' 1.642 −56.544 −161.342 Set 3 Jupiter 14h 21m 18s −13° 0.1' 6.395 −56.780 −161.126 Set 4 Venus 14h 21m 11s −12° 42.8' 1.642 −54.981 152.224 Set 4 Jupiter 14h 21m 14s −12° 59.8' 6.395 −55.244 152.038 Set 5 Venus 14h 21m 22s −12° 43.7' 1.642 −57.625 174.471 Set 5 Jupiter 14h 21m 16s −12° 60.0' 6.395 −57.897 174.480 Set 6 Venus 14h 21m 16s −12° 43.2' 1.642 −56.648 162.352 Set 6 Jupiter 14h 21m 15s −12° 59.9' 6.395 −56.920 162.250 Set equal, while condition fails at julian second 2458070.75649605 7 Venus 14h 21m 14s −12° 43.1' 1.642 −56.026 157.953 Set 7 Jupiter 14h 21m 14s −12° 59.8' 6.395 −56.295 157.814 Set equal seconds is 2458070.75649605 Script executed at Thu Jan 3 09:25:42 2019 1 Venus 14h 22m 15s −12° 48.4' 1.642 −28.309 −100.519 Set 1 Jupiter 14h 21m 25s −13° 0.7' 6.394 −28.308 −100.193 Set 2 Venus 14h 21m 10s −12° 42.7' 1.642 −54.559 150.266 Set 2 Jupiter 14h 21m 14s −12° 59.8' 6.395 −54.819 150.066 Set 3 Venus 14h 21m 42s −12° 45.6' 1.642 −52.400 −141.869 Set 3 Jupiter 14h 21m 19s −13° 0.3' 6.395 −52.576 −141.551 Set 4 Venus 14h 21m 27s −12° 44.2' 1.642 −57.614 −173.985 Set 4 Jupiter 14h 21m 17s −13° 0.0' 6.395 −57.874 −173.870 Set 5 Venus 14h 21m 19s −12° 43.5' 1.642 −57.187 167.450 Set 5 Jupiter 14h 21m 15s −12° 59.9' 6.395 −57.460 167.394 Set equal, while condition fails at julian second 2458070.75927645 6 Venus 14h 21m 15s −12° 43.1' 1.642 −56.283 159.644 Set 6 Jupiter 14h 21m 15s −12° 59.9' 6.395 −56.553 159.518 Set equal seconds is 2458070.75927645 $ #### $ cat 5.triton.pl #!/usr/bin/perl -w use 5.011; use WWW::Mechanize::GZip; use HTML::TableExtract; use Prompt::Timeout; use open ':std', OUT => ':utf8'; use constant TIMEOUT => 3; use constant MAXTRIES => 30; use Data::Dumper; #use utils1; ### re-set for ultima thule ## redesign for solar eclipse of aug 21, 2017 # declarations, initializations to precede main control my ( $moon_seconds, $sun_seconds, $equal_sec, $equal ); # set time boundaries my ( $before_bound, $after_bound ) = ( 2458070.47111, 2458071.47111); # hard code 2 objects to look at (rows) my $e1 = 4; #venus my $e2 = 7; #jupiter # hard code column my $column = 1; #right ascension my $filename = '2.jv.txt'; #output file my $now_string = localtime; open( my $jh, '>>', $filename ) or die "Could not open file '$filename' $!"; say $jh "Script executed at $now_string"; my $attempts = 1; my ( $lower, $upper ) = ( $before_bound, $after_bound ); my $site = 'http://www.fourmilab.ch/yoursky/cities.html'; my $mech = 'WWW::Mechanize::GZip'->new; $mech->get($site); $mech->follow_link( text => 'Portland OR' ); $mech->set_fields(qw'date 2'); #julian date specified my $ref_final; #reference to outlive what follows # determine equality by contracting stochastically while ( ( ( $attempts == 1 ) || ( $sun_seconds != $moon_seconds ) ) ) { my $default = ( ( $attempts >= MAXTRIES ) ) ? 'N' : 'Y'; my $answer = prompt( "Make query number $attempts?", $default, TIMEOUT ); exit if $answer =~ /^N/i; my $guess = closetohalf( $upper, $lower ); $mech->set_fields( jd => $guess ); $mech->click_button( value => "Update" ); my $te = 'HTML::TableExtract'->new; $te->parse( $mech->content ); my $table = ( $te->tables )[3]; #ephemeris table # looking to get the whole row my $aoa_ref = $table->rows(); #print_aoa( $aoa_ref ); #my $inverted = invert_aoa( $aoa_ref ); #print_aoa( $inverted ); $ref_final = $aoa_ref; # my $row_ref1 = $table->row($e1); my @row1 = @$row_ref1; my $row_ref2 = $table->row($e2); my @row2 = @$row_ref2; my $moon = $row1[$column]; my $sun = $row2[$column]; $moon_seconds = string_to_second($moon); $sun_seconds = string_to_second($sun); if ( $sun_seconds < $moon_seconds ) { $upper = $guess; } elsif ( $moon_seconds < $sun_seconds ) { $lower = $guess; } else { $equal = $guess; say $jh "equal, while condition fails at julian second $equal"; $equal_sec = $moon_seconds; } say $jh "$attempts @row1"; say $jh "$attempts @row2"; $attempts++; } say $jh "equal seconds is $equal"; #print_aoa( $ref_final ); print Dumper $ref_final; sub string_to_second { my $string = shift; my $return; if ( my $success = $string =~ /^(\d*)h\s+(\d*)m\s+(\d*)s$/ ) { $return = 3600 * $1 + 60 * $2 + $3; } else { } return $return; } sub closetohalf { my ( $up, $low ) = @_; $low + ( $up - $low ) * ( 0.4 + rand 0.2 ); } $