I'm using Finance::Quote 1.35 with Strawberry Perl 5.18.2 (built for MSwin32-x86-multi-thread-64int) in Windows 8 cmd window. Also have McAfee Security Center 12.8.988, McAfee Anti-Virus 16.8.819, McAfee Personal Firewall 13.8. Strawberry Perl is running on a flash drive if that matters.

Here's my subroutine.

sub getquote {my($sym,$qdate)=@_; # Symbol is 'googl' in lowercase and date is '201 +40822'. my($dt,$quote,$s,$t,$procname,$exch); my(%info,@exchanges); $procname="getquote"; $sym=uc($sym); # First qet quote. # Do not load Yahoo::Base. #$quote=Finance::Quote->new("-defaults","Fidelity","Yahoo::USA","Tiaac +ref"); $quote=Finance::Quote->new; # Loads 116 default exchanges. @exchanges=sort($quote->sources); # See all exchanges here. $quote->timeout(60); $quote->require_labels(qw/success errormsg price date exchange name/); $quote->set_currency("USD"); $exch="usa"; %info=$quote->fetch($exch,$sym,'A','MSFT'); if (! %info) { $s="$procname ERROR: No information returned for symbol $sym from +$exch"; writeerr($s); return; # getquote() } $dt=$info{$sym,'date'}; print "Price of $sym is ".$info{$sym,'price'}." for ".$dt."\n"; # DEBU +G return; # getquote }
Right after the $quote->fetch I do at the debugger prompt "print Dumper(\%info)" and I get this: "$VAR1 = {};" which indicates the hash has nothing in it.

  1. Has anyone else gotten F::Q working in a command box on Win 8?
  2. Any ideas what may be going wrong? I'm stumped.

Thanks.


Got it. This line:
$quote->require_labels(qw/success errormsg price date exchange name/);
has invalid labels but F::Q doesn't give an error msg. So this line works:
$quote->require_labels(qw/price date exchange name/);
I can also remove the above line and F::Q still returns all data it can about the equity. F::Q really needs better error checking, but I think I have to have an account to file a bug report.
Perl 5.8.8 on Redhat Linux RHEL 5.5.56 (64-bit)

In reply to Finance::Quote returns nothing and no error by bulrush

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.