view release on metacpan or search on metacpan
devel/MyExtractUse.pm view on Meta::CPAN
$lws
['"]?(?<version>$RE{Perl}{version})
}ox;
# my $re = $use_eval_string_re;
# print "re: $re\n";
# my $str = "eval 'use Foo::Bar 3; 1' ";
# print "str: $str\n";
# if ($str =~ $use_eval_string_re) {
# print "match\n";
# require Data::Dumper;
# print Data::Dumper::Dumper(\%+);
# } else {
# print "no match\n";
# }
# exit 0;
sub from_file {
my ($class, $filename) = @_;
### from_file(): $filename
return if ($filename =~ m{selfloader-fork\.pl$});
devel/MyExtractUse.pm view on Meta::CPAN
my ($re) = @_;
if (DEBUG >= 2) { print $str; }
while ($str =~ /$re/g) {
my %ret = %+;
$ret{'pos'} = pos($str);
$ret{'version'} = version->new($ret{'version'} || 0);
push @ret, \%ret;
if (DEBUG) {
require Data::Dumper;
print Data::Dumper::Dumper(\%ret);
}
}
};
# $str = _pod_to_comments ($str);
$str = _pod_to_whitespace ($str);
$str = _comments_to_whitespace ($str);
$str = _heredoc_to_whitespace ($str);
$one->($use_base_re);
devel/brown72-import.pl view on Meta::CPAN
push @data, { symbol => $symbol,
date => App::Chart::tdate_to_iso($tdate),
close => $total,
};
$tdate++;
}
close $in or die;
print "$symbol @{[scalar @data]} values imported\n";
App::Chart::Database->add_symbol ($symbol);
# require Data::Dumper;
# print Data::Dumper->Dump([$h],['h']);
App::Chart::Download::write_daily_group ($h);
}
exit 0;
devel/closed-form.pl view on Meta::CPAN
# with Chart. If not, see <http://www.gnu.org/licenses/>.
use 5.010;
use strict;
use warnings;
use Carp;
use List::Util;
use Math::Polynomial;
use Math::BigRat;
use Math::Matrix;
use Data::Dumper;
# Math::Polynomial->verbose(1);
# Bandini
{
sub compose_weights {
my ($w1, $w2) = @_;
my @ret;
foreach my $i (0 .. $#$w1) {
foreach my $j (0 .. $#$w2) {
devel/closed-form.pl view on Meta::CPAN
}
}
return \@ret;
}
my $sma2 = [0.5, 0.5];
my @bandini = ($sma2);
while (@bandini < 10) {
push @bandini, compose_weights($sma2, $bandini[-1]);
}
foreach my $aref (@bandini) {
require Data::Dumper;
say Data::Dumper->new([$aref],['B'])->Indent(0)->Dump;
}
say scalar @{$bandini[-1]};
foreach my $aref (@bandini) {
require Data::Dumper;
$aref = [ map {$_*1024} @$aref ];
say Data::Dumper->new([$aref],['B'])->Indent(0)->Dump;
}
exit 0;
}
sub wma {
my ($N, $P) = @_;
my @coeffs = (1 .. $N);
my $total = List::Util::sum (@coeffs);
@coeffs = map {Math::BigRat->new("$_/$total")} @coeffs;
while (@coeffs < 30) { push @coeffs, Math::BigRat->new(0); }
my $f = Math::Matrix->new ([@coeffs]);
# my $f = Math::Polynomial->new (@coeffs);
# if (defined $P) {
# $f *= $P;
# }
# print Data::Dumper->Dump([$f],['matrix']);
return $f;
}
sub weights {
my %opt = @_;
my $description = $opt{'description'}
|| die "weights: missing 'description'";
my $basename = $opt{'basename'}
|| die "weights: missing 'basename'";
my $method = $opt{'method'};
devel/closed-form.pl view on Meta::CPAN
(0) x ($show_count - 1));
my $in_series = ConstantSeries->new (array => \@input);
my $ma_series = $in_series->$method ($N);
my $hi = $ma_series->hi;
$ma_series->fill (0, $hi);
my $output = $ma_series->values_array;
my @weights = @{$output}[$warmup .. $hi];
print "$basename: ",Data::Dumper->Dump([\@weights],['weights']);
}
my $N = 15;
my $N2 = int($N/2);
my $NS = int(sqrt($N));
my $p = wma($N2);
print "N2 ",$p,"\n\n";
my $q = wma($N);
devel/consider-historical.pl view on Meta::CPAN
# Chart is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with Chart. If not, see <http://www.gnu.org/licenses/>.
use strict;
use warnings;
use Data::Dumper;
use App::Chart::DBI;
use App::Chart::Download;
use App::Chart::Gtk2::Symlist;
# my $symbol_list = ['BHP.AX', 'IPG.AX', 'PBL.AX', 'MGR.AX', 'CL.NYM',
# 'CSM.AX', 'MGW.AX' ];
my $all_list = App::Chart::Gtk2::Symlist->new_from_key ('all');
my $symbol_list = $all_list->symbols;
print Dumper($symbol_list);
devel/convert-scm.pl view on Meta::CPAN
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with Chart. If not, see <http://www.gnu.org/licenses/>.
use 5.006; # 3-arg open
use strict;
use warnings;
use Data::Dumper;
use File::Basename;
use List::Util qw(min max);
use POSIX;
use Scalar::Util;
use DBI;
use Lisp::Reader;
use File::Slurp;
use Date::Calc;
devel/database-info.pl view on Meta::CPAN
# Chart is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with Chart. If not, see <http://www.gnu.org/licenses/>.
use strict;
use warnings;
use Data::Dumper;
use DBI::Const::GetInfoType;
use App::Chart;
use App::Chart::DBI;
my $dbh = App::Chart::DBI->instance();
print "DB\n";
{
print " name: ", $dbh->get_info($GetInfoType{SQL_DBMS_NAME}), "\n";
print " version: ", $dbh->get_info($GetInfoType{SQL_DBMS_VER}), "\n";
devel/database-info.pl view on Meta::CPAN
my $aref = $dbh->type_info_all;
print Dumper (\$aref);
}
print "\n";
print "database stats\n";
{
my $query = 'SELECT symbol,COUNT(*) FROM daily GROUP BY symbol ORDER BY COUNT(*)';
my $aref = $dbh->selectall_arrayref ("$query DESC LIMIT 5");
print Data::Dumper->new([$aref],['most daily records'])->Indent(1)->Dump;
$aref = $dbh->selectall_arrayref ("$query ASC LIMIT 5");
@$aref = reverse @$aref;
print Data::Dumper->new([$aref],['fewest daily records'])->Indent(1)->Dump;
}
exit 0;
devel/ema-omitted-old.pl view on Meta::CPAN
}
my @data = @_;
my @divisor;
my $divisor = 1;
foreach my $i (1 .. $#data) {
push @divisor, ($divisor *= $i);
for (my $j = $#data; $j >= $i; $j--) {
$data[$j] -= $data[$j-1];
}
if (DEBUG) { require Data::Dumper;
print Data::Dumper->Dump([\@data],['data']); }
}
if (DEBUG) { require Data::Dumper;
print Data::Dumper->Dump([\@divisor],['divisor']); }
my $ret = Math::Polynomial->new((pop @data) / (pop @divisor));
while (@data > 2) {
$ret->mul1c ($#data + $start);
$ret->[-1] += (pop @data) / (pop @divisor);
}
# $data[1]
$ret->mul1c (1 + $start);
$ret->[-1] += pop @data;
# $data[0]
devel/fixup-symlist-list.pl view on Meta::CPAN
# Chart is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with Chart. If not, see <http://www.gnu.org/licenses/>.
use strict;
use warnings;
use Data::Dumper;
use App::Chart;
use App::Chart::Gtk2::Symlist;
use App::Chart::Database;
use App::Chart::DBI;
my $dbh = App::Chart::DBI->instance;
sub fixup_seq {
my ($table, $where) = @_;
$where ||= '';
devel/fixup-yahoo-crossed.pl view on Meta::CPAN
AND low NOT NULL
AND high != low
AND volume == \'0\'
AND symbol NOT LIKE \'^%\'
AND symbol NOT LIKE \'0%.SS\'
ORDER BY date ASC
');
# MIN(date) GROUP BY symbol');
print "total ",scalar(@$aref),"\n";
require Data::Dumper;
print Data::Dumper::Dumper($aref);
print "Fixing ...\n";
foreach my $row (@$aref) {
my ($symbol, $date, $open, $high, $low, $close) = @$row;
if ($open == $low && $low == $close) {
print "$symbol $date zap\n";
my $count = $dbh->do
('UPDATE daily SET open=NULL, high=NULL, low=NULL, close=NULL
WHERE symbol=? AND date=?',
devel/fixup-yahoo-crossed.pl view on Meta::CPAN
exit 0;
}
{
print "Looking for crossed ...\n";
my $aref = $dbh->selectall_arrayref
('SELECT symbol,MIN(date) FROM daily
WHERE CAST(high AS REAL) < CAST(low AS REAL) GROUP BY symbol');
require Data::Dumper;
print Data::Dumper::Dumper($aref);
foreach my $row (@$aref) {
my ($symbol, $date) = @$row;
my $count = $dbh->do ('DELETE FROM daily WHERE symbol=? AND date >= ?',
undef,
$symbol, $date);
print "$symbol $date delete $count\n";
}
exit 0;
devel/generate-gt-names.pl view on Meta::CPAN
# Usage: perl devel/generate-gt-names.pl
#
use strict;
use warnings;
use Module::Find;
use Module::Util;
use File::Slurp;
use Data::Dumper;
use POSIX ();
my $option_verbose = 1;
POSIX::setlocale(POSIX::LC_MESSAGES(), 'C');
my @modules = Module::Find::findsubmod ('GT::Indicators');
foreach my $module (@modules) {
my $filename = Module::Util::find_installed ($module)
|| die "oops $module filename not found";
devel/generate-indicator-model.pl view on Meta::CPAN
#
# Generate and print to stdout the data for IndicatorModelGenerated.pm which
# is a catalogue of available indicator and average names, keys, etc.
use strict;
use warnings;
use ExtUtils::Manifest;
use FindBin;
use Module::Load;
use Module::Util;
use Data::Dumper;
use POSIX ();
my $option_verbose = 0;
if (($ARGV[0]||'') eq '--verbose') {
$option_verbose = 1;
shift @ARGV;
}
POSIX::setlocale(POSIX::LC_MESSAGES(), 'C');
devel/generate-indicator-model.pl view on Meta::CPAN
print " { key => $key, # $module\n";
print " name => $name,\n";
print " type => $type,\n";
print " priority => $priority,\n";
print " },\n";
}
print " ]\n";
sub dump_str {
my ($str) = @_;
return Data::Dumper->new([$str],[''])->Indent(0)->Terse(1)->Dump;
}
exit 0;
devel/lat.pl view on Meta::CPAN
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with Chart. If not, see <http://www.gnu.org/licenses/>.
use strict;
use warnings;
use App::Chart::Latest;
use App::Chart::LatestHandler;
use Data::Dumper;
$App::Chart::option{'verbose'} = 2;
my $symbol = $ARGV[0] || 'BHP.AX';
print "$symbol\n";
# require App::Chart::Gtk2::Job::Latest;
# my $job = App::Chart::Gtk2::Job::Latest->start ([$symbol]);
# sleep (10);
App::Chart::LatestHandler->download ([$symbol]);
$Data::Dumper::Sortkeys = 1;
my $latest = App::Chart::Latest->get ($symbol);
print Dumper($latest);
print "short_datetime ",$latest->short_datetime(),"\n";
print "formatted_volume ",$latest->formatted_volume()//'undef',"\n";
exit 0;
devel/makefile-from-grep.pl view on Meta::CPAN
# uncomment this to run the ### lines
#use Smart::Comments;
# use lib::abs File::Spec->catdir ($FindBin::Bin, 'lib');
use lib::abs $FindBin::RealBin;
use MyExtractUse;
my $verbose = 0;
use Data::Dumper;
$Data::Dumper::Sortkeys = 1;
my $minimum_perl_version = version->new('5');
# version->new('v5.6.0');
if (@ARGV && $ARGV[0] eq '--verbose') {
$verbose = 1;
shift @ARGV;
}
my $toplevel_dir = File::Spec->curdir;
devel/makefile-to-debs.pl view on Meta::CPAN
# Usage: ./makefile-to-debs.pl
#
# Look at Makefile.PL and compare the declared PREREQ_PM modules, and their
# versions, against what's in the Depends line of the debian/control file.
#
use strict;
use warnings;
use AptPkg::Config;
use Data::Dumper;
use File::Spec;
use FindBin;
use List::Util;
use Memoize;
use Module::CoreList;
use Module::Depends::Intrusive;
use Module::Util;
use Parse::DebControl;
use File::Slurp;
use version;
devel/makefile-to-debs.pl view on Meta::CPAN
print "Makefile.PL: no use perl version, leave at $minimum_perl_version\n";
}
my $deps = Module::Depends::Intrusive->new;
$deps->dist_dir($toplevel_dir);
$deps->find_modules;
if (my $err = $deps->error) {
die "Cannot get Makefile.PL dependencies: $err";
}
$Data::Dumper::Sortkeys = 1;
my $requires = $deps->{'requires'}; # hashref
print "Module::Depends::Intrusive gives ", Dumper ($requires);
sub depends_to_hash {
my ($str) = @_;
my %hash;
foreach my $elem (split (/, */, $str)) {
my $package = $elem;
my $version = 0;
devel/meta-read.pl view on Meta::CPAN
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License
# along with Chart. If not, see <http://www.gnu.org/licenses/>.
use strict;
use warnings;
use Data::Dumper;
use YAML;
my $filename = $ARGV[0] || 'META.yml';
my $y = YAML::LoadFile ($filename);
print Dumper($y);
devel/my-extract-use.pl view on Meta::CPAN
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with Chart. If not, see <http://www.gnu.org/licenses/>.
use strict;
use warnings;
use lib::abs '.';
use MyExtractUse;
use Data::Dumper;
my @used = MyExtractUse->from_string (<<'HERE');
package MyNewFilterModel;
use strict;
use warnings;
use Gtk2;
use base 'Gtk2::Ex::TreeModelFilter::Change';
use Glib::Object::Subclass
'Gtk2::TreeModelFilter';
HERE
print Data::Dumper->new([\@used],['used'])->Sortkeys(1)->Dump;
exit 0;
devel/myshare.pl view on Meta::CPAN
Print a quote line for each given symbol, or for the favourites list if no
symbols. Curses colours show up and down changes in green and red, if the
terminal supports that. The format is similar to the watchlist inside
Emacs.
=cut
use strict;
use warnings;
use Number::Format;
use Data::Dumper;
use App::Chart::Latest;
my $numf = Number::Format->new
(-thousands_sep => ''); # not enough room in 80 columns for thousands
my %tput_setaf_colours = ( black => 0,
red => 1,
green => 2,
yellow => 3,
devel/run-about.pl view on Meta::CPAN
use 5.010;
use strict;
use warnings;
use Gtk2 '-init';
use App::Chart;
use App::Chart::Gtk2::AboutDialog;
use FindBin;
my $progname = $FindBin::Script;
use Data::Dumper;
print "$progname: ",Data::Dumper->Dump([\%INC],['INC']);
say "$progname: App::Chart loaded from $INC{'App/Chart.pm'}";
my $toplevel = Gtk2::Window->new;
$toplevel->show_all;
App::Chart::Gtk2::AboutDialog->new->present;
# my $about = App::Chart::Gtk2::AboutDialog->instance;
# my $about = App::Chart::Gtk2::AboutDialog->instance_for_screen ($toplevel);
# $about->signal_connect (destroy => sub {
devel/run-intraday.pl 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/>.
# Usage: ./run-intraday.pl [symbol]
#
# Run up the intraday dialog.
use strict;
use warnings;
use Gtk2;
use Data::Dumper;
use App::Chart;
use App::Chart::IntradayHandler;
use App::Chart::Gtk2::IntradayDialog;
use FindBin;
my $progname = $FindBin::Script;
$App::Chart::option{'verbose'} = 1;
{
devel/run-symlist-radio.pl view on Meta::CPAN
# with Chart. If not, see <http://www.gnu.org/licenses/>.
# Run up a SymlistRadioMenu.
use strict;
use warnings;
use Gtk2 '-init';
use App::Chart::Gtk2::SymlistRadioMenu;
use Data::Dumper;
use FindBin;
my $progname = $FindBin::Script;
my $toplevel = Gtk2::Window->new('toplevel');
$toplevel->signal_connect (destroy => sub { Gtk2->main_quit });
my $hbox = Gtk2::HBox->new (0, 0);
$toplevel->add ($hbox);
devel/scandeps-to-makefile.pl view on Meta::CPAN
use warnings;
use ExtUtils::Manifest;
use File::Find;
use File::Spec;
use FindBin;
use Module::CoreList;
use Module::Depends::Intrusive;
use Module::ScanDeps;
use version;
use Data::Dumper;
$Data::Dumper::Sortkeys = 1;
my $minimum_perl_version = version->new('5.10.0');
my $toplevel_dir = File::Spec->catdir ($FindBin::Bin, File::Spec->updir);
print "toplevel $toplevel_dir\n";
push @INC, $toplevel_dir;
my $manifest_file = File::Spec->catfile ($toplevel_dir, 'MANIFEST');
my $manifest = ExtUtils::Manifest::maniread ($manifest_file);
doc/weights.pl view on Meta::CPAN
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License
# along with Chart. If not, see <http://www.gnu.org/licenses/>.
use strict;
use warnings;
use Carp;
use Data::Dumper;
use Getopt::Long;
use List::Util qw(min max);
use POSIX qw(floor ceil);
my $option_verbose = 0;
my $option_txt = 1;
my $option_png = 1;
my $option_eps = 0;
doc/weights.pl view on Meta::CPAN
my $in_series = ConstantSeries->new (array => \@input);
my $ma_series = $in_series->$method (@$parameters);
my $hi = $ma_series->hi;
$ma_series->fill (0, $hi);
my $output = $ma_series->array($opt{'array'}||'values');
my @weights = @{$output}[$warmup .. $hi];
if ($option_verbose) {
print "$basename: ",Data::Dumper->Dump([\@weights],['weights']);
}
if (abs($weights[-1]) >= 1) {
print "$basename: last weight $weights[-1]\n";
# exit 1;
}
if ($option_txt) {
text_plot ($basename, \@weights);
}
inc/MyMakeMakerGettext.pm view on Meta::CPAN
use warnings;
use ExtUtils::Manifest;
use File::Basename;
use File::Spec;
# $makemaker is an ExtUtils::MakeMaker object, return a string of rules for
# the po/mo files
#
sub postamble {
my ($makemaker) = @_;
# use Data::Dumper;
# print Dumper($makemaker);
my $po_domain = ($makemaker->{'PO_DOMAIN'}
|| '$(DISTNAME)');
my $pot_copyright_holder = ($makemaker->{'POT_COPYRIGHT_HOLDER'}
|| author_sans_email($makemaker));
my @pot_inputs = grep {/\.pm$/} keys %{$makemaker->{'PM'}};
my $pot_inputs = $makemaker->wraplist (@pot_inputs);
lib/App/Chart/Download.pm view on Meta::CPAN
my $last_modified = (defined $resp ? $resp->last_modified : undef);
foreach my $data (@{$h->{'data'}}) {
my $symbol = $data->{'symbol'};
my $this_date = $data->{'date'};
if ($latest{$symbol}) {
my $got_date = $latest{$symbol}->{'date'};
if (! defined $got_date || ! defined $this_date) {
carp "write_latest_group: $source: two records for '$symbol', but no 'date' field";
if (DEBUG || 1) {
require Data::Dumper;
print Data::Dumper->Dump([$data,$latest{$symbol}],
['data','latest-so-far']);
}
next;
}
if ($got_date ge $this_date) { next; }
}
$latest{$symbol} = $data;
}
my $error = $h->{'error'};
lib/App/Chart/Download.pm view on Meta::CPAN
$f->{'hi_tdate'}
= tdate_end_of_month (App::Chart::Download::iso_to_tdate_ceil ($m));
} elsif ($f->{'hi_year'}) {
$f->{'hi_tdate'}
= App::Chart::ymd_to_tdate_floor($f->{'hi_year'}, 12, 31);
} else {
croak 'choose_files: missing hi date';
}
}
}
if (DEBUG >= 2) { require Data::Dumper;
print Data::Dumper::Dumper($files); }
# restrict wanted range to what's available
my $lo_available = min (map {$_->{'lo_tdate'}} @$files);
my $hi_available = max (map {$_->{'hi_tdate'}} @$files);
$lo_tdate = max ($lo_tdate, $lo_available);
$hi_tdate = min ($hi_tdate, $hi_available);
if (DEBUG) { print " available $lo_available to $hi_available\n";
print " restricted range $lo_tdate to $hi_tdate\n"; }
if ($lo_tdate > $hi_tdate) { return []; }
lib/App/Chart/EmacsMain.pm view on Meta::CPAN
if (eval { require Devel::StackTrace; }) {
$backtrace = Devel::StackTrace->new->as_string;
$msg .= __('See *chart-process-backtrace* buffer');
}
emacs_write (symbol('error'), $msg, $backtrace);
return 1; # stay installed
}
sub emacs_write {
if (DEBUG >= 2) { require Data::Dumper;
print Data::Dumper::Dumper(\@_); }
if (DEBUG) { print "To emacs: ",lisp_print([@_]),"\n"; }
print $emacs_fh lisp_print([@_]),"\n";
}
my $buf = '';
sub _do_read {
my ($fd, $conditions, $mainloop) = @_;
for (;;) {
lib/App/Chart/EmacsMain.pm view on Meta::CPAN
}
if ($got == 0) {
## no critic (ProhibitExit, ProhibitExitInSubroutines)
exit 0;
}
}
my ($aref, $endpos) = Lisp::Reader::lisp_read ($buf);
$buf = substr ($buf, $endpos);
if (DEBUG) { require Data::Dumper;
print "Receive: ",Data::Dumper::Dumper($aref);
print "leaving buf ",length($buf),"\n"; }
foreach my $list (@$aref) {
call_command ($list);
}
return 1; # stay connected
}
sub call_command {
my ($list) = @_;
my $lisp_command = shift @$list;
lib/App/Chart/FinanceQuote.pm view on Meta::CPAN
|| App::Chart::Sympred::Suffix->new ($suffix);
App::Chart::LatestHandler->new
(pred => $pred,
proc => sub { latest_download ($modules, $method, $suffix, @_) },
%options);
}
sub latest_download {
my ($modules, $method, $suffix, $symbol_list) = @_;
if (DEBUG) { require Data::Dumper;
print Data::Dumper::Dumper($modules); }
# lose .FQ
$symbol_list = [ map {App::Chart::symbol_sans_suffix($_)} @$symbol_list ];
App::Chart::Download::status
(__x('FinanceQuote {method} {symbol_range}',
method => $method,
symbol_range =>
App::Chart::Download::symbol_range_string ($symbol_list)));
require Finance::Quote;
lib/App/Chart/Gtk2/HAxis.pm view on Meta::CPAN
if (DEBUG) {
print "$label_timebase label $label_width versus $t_width\n"; }
if ($label_width < $t_width || $elem == $format_list[-1]) {
$sizes->{'label_timebase'} = $label_timebase;
$sizes->{'format_func'} = $format_func;
last;
}
}
if (DEBUG) { require Data::Dumper;
print "HAxis sizes ", Data::Dumper::Dumper($sizes);
print " em=$em\n";
print " x_step=$x_step\n";
}
return $sizes;
}
# 'expose-event' class closure
sub _do_expose_event {
my ($self, $event) = @_;
if (DEBUG >= 2) { print "HAxis expose\n"; }
lib/App/Chart/Gtk2/RawInfo.pm view on Meta::CPAN
my ($self) = @_;
my $symbol = $self->{'symbol'};
my $str;
if (defined $symbol) {
### RawInfo refresh: $symbol
require App::Chart::DBI;
my $dbh = App::Chart::DBI->instance;
my $sth = $dbh->prepare_cached ('SELECT * FROM info WHERE symbol=?');
my $h = $dbh->selectrow_hashref ($sth, undef, $symbol);
require Data::Dumper;
my $dumper = Data::Dumper->new ([$h],['info']);
$dumper->Sortkeys(1);
$dumper->Quotekeys(0);
$str = $dumper->Dump;
}
$self->set_text ($str);
}
1;
__END__
lib/App/Chart/Gtk2/RawLatest.pm view on Meta::CPAN
my ($self) = @_;
my $symbol = $self->{'symbol'};
my $str;
if (defined $symbol) {
### RawLatest refresh: $symbol
require App::Chart::DBI;
my $dbh = App::Chart::DBI->instance;
my $sth = $dbh->prepare_cached ('SELECT * FROM latest WHERE symbol=?');
my $h = $dbh->selectrow_hashref ($sth, undef, $symbol);
require Data::Dumper;
my $dumper = Data::Dumper->new ([$h],['latest']);
$dumper->Sortkeys(1);
$dumper->Quotekeys(0);
$str = $dumper->Dump;
}
$self->set_text ($str);
}
1;
__END__
lib/App/Chart/Gtk2/View.pm view on Meta::CPAN
return DEFAULT_VIEWSTYLE;
}
return $viewstyle;
}
# viewstyle_write(DEFAULT_VIEWSTYLE);
# print viewstyle_read(DEFAULT_VIEWSTYLE);
# exit 0;
sub viewstyle_write {
my ($viewstyle) = @_;
require App::Chart::DBI;
require Data::Dumper;
my $str = Data::Dumper->new([$viewstyle],['viewstyle'])->Indent(1)->Terse(1)->Sortkeys(1)->Dump;
require App::Chart::DBI;
my $dbh = App::Chart::DBI->instance;
$dbh->do ('INSERT OR REPLACE INTO preference (key, value)
VALUES (\'viewstyle\',?)', {}, $str);
App::Chart::chart_dirbroadcast()->send ('viewstyle-changed');
}
#------------------------------------------------------------------------------
sub INIT_INSTANCE {