in reply to Re: polishing up a json fetching script for weather data
in thread polishing up a json fetching script for weather data
Thanks for this tip, Fletch, it has really helped me pick apart these things. I folded them into system calls in a script where I built on what worked before:
Additionally: For the warnings, the best way to get rid of them is to not trigger them. Check that you're actually getting values where you expect them before using things (alternately you could still be careless but mute them with no warnings 'undefined' in the smallest possible scope). That being said, they should be going to STDERR so if you use whatever your shell's syntax for that (e.g. myscript blah blah 2>errors).#!/usr/bin/perl use strict; use warnings; use open ':std', OUT => ':utf8'; #my $file = '1.weather.json'; #system ("cat $file | jq '[.properties]' | more"); #system ("cat $file | jq '[.properties.cloudLayers]' >2.txt"); #system ("cat $file | jq '[.properties.temperature]' >3.txt"); # these were effective commands ##different json, same host my $file = 'json_stuff/1.openapi.json'; #system ("cat $file | jq '[.]' >5.txt"); #system ("cat $file | jq '[.paths]' >6.txt"); system ("cat $file | jq '[.paths.get]' >7.txt"); __END__
That's the ticket.
$ ./6.weather.pl 2>errors
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: polishing up a json fetching script for weather data
by haukex (Archbishop) on May 22, 2020 at 08:18 UTC | |
by Aldebaran (Curate) on May 23, 2020 at 08:20 UTC | |
by haukex (Archbishop) on May 23, 2020 at 08:23 UTC |