in reply to polishing up a json fetching script for weather data

Can you post 4.conf so your example is runable? Without the logging I get:

failed to GET(https://api.weather.gov/stations/KPDX/observations/lates +t) with 502 at ex.pl line 26.

Do you have a URL which currently isn't failing?

Replies are listed 'Best First'.
Re^2: polishing up a json fetching script for weather data
by Aldebaran (Curate) on May 13, 2020 at 05:08 UTC
    Can you post 4.conf so your example is runable?

    I use differing conf files based on whether I want DEBUG or INFO. These are modeled after the examples:

    ###################################################################### +######### # Log::Log4perl Conf + # ###################################################################### +######### log4perl.rootLogger = INFO, LOG1, SCREEN log4perl.appender.SCREEN = Log::Log4perl::Appender::Screen log4perl.appender.SCREEN.stderr = 0 log4perl.appender.SCREEN.layout = Log::Log4perl::Layout::PatternLayou +t log4perl.appender.SCREEN.layout.ConversionPattern = %m %n log4perl.appender.LOG1 = Log::Log4perl::Appender::File log4perl.appender.LOG1.filename = /home/hogan/Documents/hogan/logs/4. +log4perl.txt log4perl.appender.LOG1.mode = append log4perl.appender.LOG1.layout = Log::Log4perl::Layout::PatternLayou +t log4perl.appender.LOG1.layout.ConversionPattern = %d %p %m %n

    is 4.conf, and its partner, 3.conf only differs by a word:

    ###################################################################### +######### # Log::Log4perl Conf + # ###################################################################### +######### log4perl.rootLogger = DEBUG, LOG1, SCREEN log4perl.appender.SCREEN = Log::Log4perl::Appender::Screen log4perl.appender.SCREEN.stderr = 0 log4perl.appender.SCREEN.layout = Log::Log4perl::Layout::PatternLayou +t log4perl.appender.SCREEN.layout.ConversionPattern = %m %n log4perl.appender.LOG1 = Log::Log4perl::Appender::File log4perl.appender.LOG1.filename = /home/hogan/Documents/hogan/logs/3. +log4perl.txt log4perl.appender.LOG1.mode = append log4perl.appender.LOG1.layout = Log::Log4perl::Layout::PatternLayou +t log4perl.appender.LOG1.layout.ConversionPattern = %d %p %m %n
    Do you have a URL which currently isn't failing?

    Yes and no. the url was correct, but I had been using

    my $jsonstr = $ua->get( $query )->res->dom;

    to fetch the json, and it was unsuccessful for that reason. You use the correct url and fetching query in the newest script you posted.