App-Chart

 view release on metacpan or  search on metacpan

lib/App/Chart/Database.pm  view on Meta::CPAN

sub read_extra {
  my ($class, $symbol, $key) = @_;
  return read_single ('SELECT value FROM extra WHERE symbol=? AND key=?',
                      $symbol, $key);
}

# An eval isn't backtrace friendly, but a __DIE__ handler would be reached
# by possible normal errors caught by a handler in $subr.
#
# rollback() can get errors too, like database gone away.  They end up
# thrown in preference to the original error.
#
sub call_with_transaction {
  my ($dbh, $subr) = @_;
  my $hold = App::Chart::chart_dirbroadcast()->hold;

  if ($dbh->{AutoCommit}) {
    my $ret;
    $dbh->begin_work;
    if (eval { $ret = $subr->(); 1 }) {
      $dbh->commit;

lib/App/Chart/Download.pm  view on Meta::CPAN

# $day)>, similar to what C<Date::Calc> does.
# 
# The month given can be a number or a name in English and is always returned
# as a number.  Any separator can be used between the components and leading
# and trailing whitespace is ignored.  If the string is unrecognised the
# return is an empty list C<()>.
# 
# =item App::Chart::Download::Decode_Date_YMD_to_iso ($str)
# 
# Decode a date using C<App::Chart::Download::Decode_Date_YMD> above and return
# an ISO format string "YYYY-MM-DD".  An error is thrown if C<$str> is
# invalid.
# 
# =item App::Chart::Download::date_parse_to_iso ($str)
#
# unused?
# 
# Apply Date::Parse::strptime() to C<$str> and return an ISO format date
# string like "2007-10-26" for the result.  An error is thrown if C<$str> is
# unrecognisable.
# 
# =back
# 
# =item weekday_date_after_time ($hour,$min, $timezone, [$offset])
# 
# Return an an ISO format date string like C<"2008-08-20"> which is a weekday,
# giving today on a weekday after C<$hour>,C<$min>, or the previous weekday if
# before that time or any time on a weekend.
# 

lib/App/Chart/Gtk2/IntradayImage.pm  view on Meta::CPAN


  my $loader = Gtk2::Gdk::PixbufLoader->new();
  my $pixbuf;
  if (eval {
    $loader->write ($image);
    $loader->close ();
    $pixbuf = $loader->get_pixbuf;
    1 }) {
    return $pixbuf;
  } else {
    # Should be Glib::Error in $@ thrown by $loader, but allow for plain
    # string too.
    my $err = "$@";
    unless (utf8::is_utf8($err)) { $err = Encode::decode('locale',$err); }
    return $err;
  }
}

sub _do_intraday_changed {
  my ($self, $symbol, $mode) = @_;
  ### IntradayImage _do_intraday_changed(): "\"$symbol\" \"$mode\"\n"

lib/App/Chart/Sympred.pm  view on Meta::CPAN

=item C<< $sympred->match ($symbol) >>

Return true if C<$symbol> is matched by the C<$sympred> object.

=item C<< $sympred->add ($pred,...) >>

Add additional predicates to a C<App::Chart::Sympred::Any> object.

=item C<< App::Chart::Sympred::validate ($obj) >>

Check that C<$obj> is a C<App::Chart::Sympred> object, throw an error if not.

=back

=head1 HOME PAGE

L<http://user42.tuxfamily.org/chart/index.html>

=head1 LICENCE

Copyright 2007, 2008, 2009, 2010, 2013, 2015, 2016 Kevin Ryde

lib/App/Chart/TZ.pm  view on Meta::CPAN

handler code and then looked up here.

=head1 FUNCTIONS

=over 4

=cut

=item App::Chart::TZ::validate ($obj)

Check that C<$obj> is a C<App::Chart::TZ> object, throw an error if
not.

=item C<< App::Chart::TZ->loco >>

Return a timezone object representing the local timezone (which means
leaving C<TZ> at its initial setting).

=item C<< App::Chart::TZ->chicago >>

=item C<< App::Chart::TZ->london >>

t/1-Test-UseAllModules.t  view on Meta::CPAN

# You should have received a copy of the GNU General Public License along
# with Chart.  If not, see <http://www.gnu.org/licenses/>.


# load all modules with Test::UseAllModules, if that's available

use strict;
use warnings;
use Test::More;

# Test::UseAllModules 0.11 need import() run, or all_uses_ok() would throw
# an error, hence eval "use" here.
#
if (! eval 'use Test::UseAllModules; 1') {
  plan skip_all => "due to Test::UseAllModules not available ($@)";
}

use lib 't';
use MyTestHelpers;
MyTestHelpers::nowarnings();

t/Ticker.t  view on Meta::CPAN

require Glib;
Glib->VERSION (1.220); # for TreeModelFilter callback not leaking

require Gtk2;
Gtk2->disable_setlocale;  # leave LC_NUMERIC alone for version nums
my $have_display = Gtk2->init_check;

#------------------------------------------------------------------------------

# The size calculation in App::Chart::Gtk2::Ticker INIT_INSTANCE uses some
# pango measures (from Gtk2::Ex::Units) which throw warnings and stuff if no
# display, so restrict the following tests.  (In the past it was ok for some
# reason.)
#
# But ... these isa() tests are not right.  If an empty database (any fresh
# setup) then App::Chart::Gtk2::Ticker goes to an empty ListStore instead of
# a symlist.
# 
# SKIP: {
#   $have_display or skip 'due to no DISPLAY available', 4;
#   my $ticker = App::Chart::Gtk2::Ticker->new;

unused/YahooOld.pm  view on Meta::CPAN


# quote_parse_div_date ($str) returns an iso YYYY-MM-DD date string for a
# dividend $str coming from quote.csv data, or undef if none.  There are
# several different formats,
#           "Jan 7"        # finance.yahoo.com
#           " 5 Jan"  	   # au.finance, uk.finance
#           "24-Sep-04"    # ABB.AX on finance.yahoo.com
#           "24 Sep, 2004" # ABB.AX on au.finance
#           "Sep 24, 2004" # ABB.AX on ca.finance
#
# An error is thrown for an unrecognised string, don't want some new form to
# end up with dividends silently forgotten.
#
sub quote_parse_div_date {
  my ($str) = @_;
  if (DEBUG) { print "quote_parse_div_date() '$str'\n"; }
  if (! defined $str || $str eq 'N/A' || $str eq '') {
    return undef; # no info
  }

  my ($ss,$mm,$hh,$day,$month,$year,$zone) = Date::Parse::strptime ($str);



( run in 0.273 second using v1.01-cache-2.11-cpan-496ff517765 )