There was a system error retrieving the price quotes. This error is a debugging nightmare as it is not specific, gives no clue as to where the error lies and there is no easy debugging mechanism to find out what went wrong. Nonetheless, all is not lost. In order to debug the problem, open a … Continue reading How to debug “There was a system error retrieving the price quotes” in Gnucash Finance::Quotes on Linux
Category: Perl
How to overcome erratic retrieval of stock quotes from the BSE India website in Gnucash Finance::Quotes MumbaiStock module
The below Perl code segment was used in the Finance::Quotes::MumbaiStock module which is used to retrieve stock quotes from BSE India. #Fetch the file using user_agent #$ua = $quoter->user_agent; Replaced by get_user_agent $ua = $quoter->get_user_agent(); #make user_agent as empty for conducive server response $ua->agent(''); $url = "$MSTK_URL"; $reply = $ua->mirror($url, $MSTK_ZIP); If $ua was made … Continue reading How to overcome erratic retrieval of stock quotes from the BSE India website in Gnucash Finance::Quotes MumbaiStock module
How to break up time in perl into it’s various elements
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); my $today = time(); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($today); Note that localtime($today) will break up the date value in $today variable. If you want to go back 3 days, do: $today = $today - (60*60*24);
How to unzip a zip file in Perl
To unzip a file in Perl: use IO::Uncompress::Unzip qw(unzip $UnzipError); my $input = $ZIP; my $output = $UNZIPPED; unzip $input => $output or die "unzip failed: $UnzipError\n"; where $ZIP is the variable with the zip file name and $UNZIPPED is the unzipped file.
How to fetch content from URLs using Fetch method in Perl
To fetch content from a particular URL in Perl, use the fetch method. The following code segment illustrates how it can be done. use File::Fetch; my $ff = File::Fetch->new(uri => $url); my $file = $ff->fetch(to => '/tmp') or die $ff->error; where $url is the URL from where content is to be fetched.
How to debug MumbaiStock.pm with Finance::Quotes
After creating or editing any of the Finance::Quotes modules you need to test them. To test, open a terminal window and do the following to check if the module gives any errors: Copy the modified module to the Finance/Quotes folder$ sudo cp MumbaiStock.pm /usr/share/perl5/Finance/Quote/MumbaiStock.pm <enter> Check if the code has any syntax errors$ perl -e … Continue reading How to debug MumbaiStock.pm with Finance::Quotes
How to use GIT to publish project / source code to github
Git is a very good tool that allows you to publish your project or source code to the github web repository. It allows others to view your code / project and make changes, with one of the best version control systems around. I will use the MumbaiStock project on github as an example to illustrate … Continue reading How to use GIT to publish project / source code to github
How to create a new stock quote source for Gnucash using Finance::Quote
This post is for technical users. The objective is to share how the MumbaiStock.pm module was created. Visit this other post to know how to add the MumbaiStock.pm to Gnucash. Problem:Gnucash is used to manage personal finances. Gnucash can retrieve online price quotes from the NSE or the BSE through Yahoo Finance. Unfortunately, Yahoo Finance … Continue reading How to create a new stock quote source for Gnucash using Finance::Quote
How to open multiple buffers in JEdit like in GEdit or Mousepad
Many of us use a text editor to edit program code. The simplest and clean edit is GEdit on the Gnome desktop. However, if you are not on the Gnome desktop, you may miss it. You can use JEdit which is much more powerful, however, by default, it does not open multiple programs alongside each … Continue reading How to open multiple buffers in JEdit like in GEdit or Mousepad
Add PERL modules using CPAN
$ su # perl -MCPAN -e shell Answer <ENTER> to all questions (choose defaults) To install CPAN modules: Start up internet # cpan>install Time::HiRes This will install and compile the downloaded module.