##
#source 5.1.mp.txt
#source 5.mp.txt
b 262
c
s
v
p @_
p $debug
b 312
b 317
c
v
n
n
s
v
l 280-300
b 289
c
n
r
s
v
n
p $json_string
l 198-215
r
c
c
c
c
s
v
n
p $json_string
c
c
c
c
s
n
p $json_string
B *
c
#save 5.mp.monk.txt
##
##
$ perl -d 5.mp.pl
Loading DB routines from perl5db.pl version 1.55
Editor support available.
Enter h or 'h h' for help, or 'man perldebug' for more help.
Subroutine get_logger redefined at 5.mp.pl line 83.
at 5.mp.pl line 83.
main::(5.mp.pl:32): my $debug = 1;
DB<1> source 5.1.mp.txt
>> #source 5.mp.txt
##
##
>> b 262
>> c
INFO: 5.mp.pl
at 5.mp.pl line 94.
event2epoch(): setting time to '03:22:31' ...
event2epoch(): setting timezone via 'location' coordinates lat:43.61, lon:-116.2 ...
event2epoch(): deduced timezone to 'Etc/GMT-7' and setting it ...
INFO: Moon age: 8.12733852952393 days
at 5.mp.pl line 103.
INFO: Moon phase: 27.5 % of cycle (birth-to-death)
at 5.mp.pl line 104.
INFO: Moon's illuminated fraction: 57.9 % of full disc
at 5.mp.pl line 107.
main::get_elevation_from_coordinates(5.mp.pl:262):
262: my ( $lat, $lon, $debug ) = @_;
>> s
main::get_elevation_from_coordinates(5.mp.pl:268):
268: $debug //= 0;
>> v
265: use HTTP::Request;
266: use Data::Roundtrip;
267
268==> $debug //= 0;
269
270: my $ua = LWP::UserAgent->new( agent =>
271 'MozThese values are not the zero values I was concerned about
illa/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0', );
272
273: my $response;
274: my $payload =
>> p @_
43.61-116.20
>> p $debug
0
>> b 312
>> b 317
##
##
>> c
main::get_elevation_from_coordinates(5.mp.pl:312):
312: $response = $ua->request($req);
>> v
309 "$0 : $payload\n$0 : sending above payload, of $payloadlen bytes...\n";
310 }
311
312==>b $response = $ua->request($req);
313: die "Error fetching: " . $response->status_line
314 unless $response->is_success;
315
316: my $content = $response->decoded_content;
317:b my $data = Data::Roundtrip::json2perl($content);
318 die "failed to parse received data:\n$content\n"
...
>> s
HTTP::Message::decoded_content(/usr/share/perl5/HTTP/Message.pm:283):
283: my($self, %opt) = @_;
>> v
280
281 sub decoded_content
282 {
283==> my($self, %opt) = @_;
284: my $content_ref;
285: my $content_ref_iscopy;
286
287: eval {
288: $content_ref = $self->content_ref;
289: die "Can't decode ref content" if ref($content_ref) ne "SCALAR";
>> l 280-300
280
281 sub decoded_content
282 {
283==> my($self, %opt) = @_;
284: my $content_ref;
285: my $content_ref_iscopy;
286
287: eval {
288: $content_ref = $self->content_ref;
289: die "Can't decode ref content" if ref($content_ref) ne "SCALAR";
290
291: if (my $h = $self->header("Content-Encoding")) {
292: $h =~ s/^\s+//;
293: $h =~ s/\s+$//;
294: for my $ce (reverse split(/\s*,\s*/, lc($h))) {
295: next unless $ce;
296: next if $ce eq "identity" || $ce eq "none";
297: if ($ce eq "gzip" || $ce eq "x-gzip") {
298: require IO::Uncompress::Gunzip;
299: my $output;
300: IO::Uncompress::Gunzip::gunzip($content_ref, \$output, Transparent => 0)
>> b 289
>> c
HTTP::Message::decoded_content(/usr/share/perl5/HTTP/Message.pm:289):
289: die "Can't decode ref content" if ref($content_ref) ne "SCALAR";
>> n
HTTP::Message::decoded_content(/usr/share/perl5/HTTP/Message.pm:291):
291: if (my $h = $self->header("Content-Encoding")) {
>> r
scalar context return from HTTP::Message::decoded_content: '{"elevation":821,"success":true,"requestNum":"163546920137"}'
##
##
main::get_elevation_from_coordinates(5.mp.pl:317):
317: my $data = Data::Roundtrip::json2perl($content);
318: die "failed to parse received data:\n$content\n"
>> s
Data::Roundtrip::json2perl(/usr/local/share/perl/5.30.0/Data/Roundtrip.pm:192):
192: my $json_string = $_[0];
>> v
189: return $pv
190 }
191 sub json2perl {
192==> my $json_string = $_[0];
193 #my $params = defined($_[1]) ? $_[1] : {};
194: my $pv = JSON::decode_json(Encode::encode_utf8($json_string));
195: if( ! defined $pv ){ warn "json2perl() : error, call to json2perl() has failed"; return undef }
196: return $pv;
197 }
198 sub json2json {
>> n
Data::Roundtrip::json2perl(/usr/local/share/perl/5.30.0/Data/Roundtrip.pm:194):
194: my $pv = JSON::decode_json(Encode::encode_utf8($json_string));
>> p $json_string
{"elevation":821,"success":true,"requestNum":"163546920137"}
>> l 198-215
198 sub json2json {
199: my $json_string = $_[0];
200: my $params = defined($_[1]) ? $_[1] : {};
201
202: my $pv = json2perl($json_string, $params);
203: if( ! defined $pv ){ warn "json2perl() : error, call to json2perl() has failed"; return undef }
204: $json_string = perl2json($pv, $params);
205: if( ! defined $json_string ){ warn "json2perl() : error, call to perl2json() has failed"; return undef }
206
207: return $json_string;
208 }
209 sub yaml2yaml {
210: my $yaml_string = $_[0];
211: my $params = defined($_[1]) ? $_[1] : {};
212
213: my $pv = yaml2perl($yaml_string, $params);
214: if( ! defined $pv ){ warn "yaml2perl() : error, call to yaml2perl() has failed"; return undef }
215: $yaml_string = perl2yaml($pv, $params);
>> r
scalar context return from Data::Roundtrip::json2perl: 'elevation' => 821
'requestNum' => 163546920137
'success' => JSON::PP::Boolean=SCALAR(0x55e918df2b78)
-> 1
##
##
...
event2epoch(): setting time to '03:22:31' ...
event2epoch(): setting timezone via 'location' coordinates lat:15.6325, lon:38.245833 ...
event2epoch(): deduced timezone to 'Africa/Asmara' and setting it ...
...
{"elevation":841,"success":true,"requestNum":"163546921268"}
DB<13> c
INFO: return from the google is 841 meters
at 5.mp.pl line 115.
INFO: on the Scylla on 2021-10-14T03:22:31 (1634170951 seconds unix-epoch) timezone: Africa/Nairobi (lat: 15.6325, lon: 38.245833) at height 843 meters
##
##
...
event2epoch(): setting time to '03:22:31' ...
event2epoch(): setting timezone via 'location' coordinates lat:-43.61, lon:63.8 ...
event2epoch(): deduced timezone to 'Etc/GMT+4' and setting it ...
...
DB<13> c
main::get_elevation_from_coordinates(5.mp.pl:317):
317: my $data = Data::Roundtrip::json2perl($content);
318: die "failed to parse received data:\n$content\n"
DB<13> s
Data::Roundtrip::json2perl(/usr/local/share/perl/5.30.0/Data/Roundtrip.pm:192):
192: my $json_string = $_[0];
DB<13> n
Data::Roundtrip::json2perl(/usr/local/share/perl/5.30.0/Data/Roundtrip.pm:194):
194: my $pv = JSON::decode_json(Encode::encode_utf8($json_string));
DB<13> p $json_string
{"elevation":0,"success":true,"requestNum":"163546928850"}
##
##
DB<14> B *
Deleting all breakpoints...
DB<15> c
INFO: return from the google is 0 meters
at 5.mp.pl line 115.
INFO: in Antipo' 'Ho on 2021-10-14T03:22:31 (1634196151 seconds unix-epoch) timezone: -0400 (lat: -43.61, lon: 63.8) at height 2 meters
at 5.mp.pl line 117.
...
Debugged program terminated. Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.
DB<15> save 5.mp.monk.txt
commands saved in 5.mp.monk.txt
DB<16> q
$
##
##
INFO: on the Scylla on 2021-10-14T03:22:31 (1634170951 seconds unix-epoch) timezone: Africa/Nairobi (lat: 15.6325, lon: 38.245833) at height 843 meters
INFO: Object Azimuth Elevation
INFO: Venus 168.793996164728 -81.0110616258686
INFO: Jupiter 258.080321870357 -14.8575841846033
INFO: Moon 251.270738258432 -35.2685064885712
INFO: Saturn 256.410482564197 -30.2637811706649
##
##
$ perl -Mre=debug -e "/just|another|perl|hacker/"
Compiling REx "just|another|perl|hacker"
~ tying lastbr BRANCH (11) to ender END (15) offset 4
Final program:
1: TRIEC-EXACT[ahjp] (15)
15: END (0)
stclass AHOCORASICKC-EXACT[ahjp] minlen 4
Freeing REx: "just|another|perl|hacker"
$