From a6276708c0bdebea5ceea364ad5d266d8651503e Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sun, 14 Mar 2021 09:54:11 -0700 Subject: [PATCH] Bug 797630 - Check for missing dependencies of 'Get Quotes'... to avoid Gnucash crash. We already did, just not in the right order to get the error to percolate up to price-quotes.scm. --- libgnucash/quotes/gnc-fq-helper.in | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/libgnucash/quotes/gnc-fq-helper.in b/libgnucash/quotes/gnc-fq-helper.in index 95e7210c5a..ab9f496b3e 100755 --- a/libgnucash/quotes/gnc-fq-helper.in +++ b/libgnucash/quotes/gnc-fq-helper.in @@ -23,10 +23,6 @@ use strict; use English; -use FileHandle; - -# Date::Manip provides ParseDate, ParseDateString, and UnixTime. -use Date::Manip; =head1 NAME @@ -112,15 +108,14 @@ non-zero - failure =cut -# Set a base date with the current time in the current TZ: -my $base_date = new Date::Manip::Date; -$base_date->parse("now"); - # The methods we know about. For now we assume they all have the same # signature so this works OK. sub check_modules { - my @modules = qw(Finance::Quote Date::Manip); + +# Date::Manip provides ParseDate, ParseDateString, and UnixTime. + + my @modules = qw(FileHandle Finance::Quote Date::Manip); my @missing; foreach my $mod (@modules) { @@ -149,6 +144,13 @@ sub check_modules { exit 1; } +# Check for and load non-standard modules +check_modules (); + +# Set a base date with the current time in the current TZ: +my $base_date = new Date::Manip::Date; +$base_date->parse("now"); + sub schemify_string { my($str) = @_; @@ -319,9 +321,6 @@ sub parse_input_line { #--------------------------------------------------------------------------- # Runtime. -# Check for and load non-standard modules -check_modules (); - # Create a stockquote object. my $quoter = Finance::Quote->new(); my $prgnam = "gnc-fq-helper";