view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
'Date::Calc' => '5.0', # 5.0 for various Localtime() etc
'Date::Parse' => 0,
'DBI' => 0,
'DBI::Const::GetInfoType' => 0, # in DBI 1.22 or higher
# version 1.20 for fix resetting after an error like column not found
# (RT ticket 30558 on version 1.14. The debian 1.14-2 had a patch which
# worked.)
# version 1.27 for its incompatible change "sqlite_unicode"
'DBD::SQLite' => 1.27,
'Encode::Locale' => 0,
# think 0.61 is good, to get undef for a non-existent $HOME
'File::HomeDir' => 0.61,
# builtin in perl 5.10, but also separately on CPAN, maybe
'File::Spec' => 0,
doc/chart.texi view on Meta::CPAN
@cindex Commodity name translations
@cindex Name translations
@cindex Weblink
Names are downloaded in the selected or highest preference language, when
there's a choice. Weblinks to company information or the exchange home page
likewise.
@item Annotations
@cindex Annotation locale
@cindex UTF-8
Annotation notes (@pxref{Annotations}) can be entered with unicode characters.
@c , Dividends
@c and dividends (@pxref{Dividends}) ...
@end table
@c @ifinfo
@c @sp 1
@c @end ifinfo
@section Locale Selection
@cindex Locale selection
lib/App/Chart.pm view on Meta::CPAN
sub ymd_to_tdate_ceil {
my ($year, $month, $day) = @_;
return adate_to_tdate_ceil (ymd_to_adate ($year, $month, $day));
}
#------------------------------------------------------------------------------
sub collapse_whitespace {
my ($str) = @_;
$str =~ s/\x{A0}+/ /g; # latin1/unicode non-breaking space
$str =~ s/$RE{ws}{crop}//g; # leading and trailing whitespace
$str =~ s/\s+/ /g; # middle whitespace
return $str;
}
#------------------------------------------------------------------------------
sub decimal_sub {
my ($x, $y) = @_;
# would prefer an actual decimal-arithmetic subtract here
lib/App/Chart/DBI.pm view on Meta::CPAN
### $notes_filename
if (! -e $notes_filename) {
require App::Chart::Database::Create;
App::Chart::Database::Create::initial_notes ($notes_filename);
}
require DBI;
my $dbh = DBI->connect ("dbi:SQLite:dbname=$database_filename",
'', '', {RaiseError=>1});
$dbh->func(90_000, 'busy_timeout'); # 90 seconds
$dbh->{'sqlite_unicode'} = 1;
$dbh->do ('ATTACH DATABASE ' . $dbh->quote($notes_filename)
. ' AS notesdb');
my ($dbversion) = do {
local $dbh->{RaiseError} = undef;
local $dbh->{PrintError} = undef;
$dbh->selectrow_array
("SELECT value FROM extra WHERE key='database-schema-version'")
};
$dbversion ||= 0;
lib/App/Chart/Database/Create.pm view on Meta::CPAN
# $database_filename is in filesystem charset bytes
sub initial_database {
my ($database_filename) = @_;
print __x("Creating {filename}\n",
filename => Glib::filename_display_name($database_filename));
File::Path::mkpath (File::Basename::dirname ($database_filename));
my $dbh = DBI->connect ("dbi:SQLite:dbname=$database_filename",
'', '', {RaiseError=>1});
$dbh->{sqlite_unicode} = 1;
$dbh->do ('PRAGMA encoding = "UTF-8"');
$dbh->do (<<'HERE');
CREATE TABLE daily (
symbol TEXT NOT NULL,
date DATE NOT NULL,
open TEXT DEFAULT NULL,
high TEXT DEFAULT NULL,
low TEXT DEFAULT NULL,
lib/App/Chart/Database/Create.pm view on Meta::CPAN
'', '', {RaiseError=>1});
}
# $notes_filename is in filesystem charset bytes
sub initial_notes {
my ($notes_filename) = @_;
print __x("Creating {filename}\n",
filename => Glib::filename_display_name($notes_filename));
my $nbh = nbh();
$nbh->{sqlite_unicode} = 1;
$nbh->do ('PRAGMA encoding = "UTF-8"');
$nbh->do ($create_preference);
$nbh->do (<<'HERE');
CREATE TABLE annotation (
symbol TEXT NOT NULL,
id INT NOT NULL,
date DATE NOT NULL,
note TEXT NOT NULL,
lib/App/Chart/DownloadHandler.pm view on Meta::CPAN
my ($class, %self) = @_;
$self{'pred'} or croak __PACKAGE__,": missing pred";
$self{'proc'} or croak __PACKAGE__,": missing proc";
App::Chart::Sympred::validate ($self{'pred'});
my $self = bless \%self, $class;
push @handler_list, $self;
$self{'name'} ||= do {
my ($package,$filename,$line) = caller();
"$package:" . Glib::filename_to_unicode($filename) . ":$line" };
# highest priority first and 'stable' above for order added for equals
@handler_list
= sort { ($b->{'priority'}||0) <=> ($a->{'priority'}||0) }
@handler_list;
return $self;
}
sub name {
lib/App/Chart/Suffix/NZ.pm view on Meta::CPAN
#------------------------------------------------------------------------------
# (String quoting for parsing of <script> in HTML to get crumb.)
# undo javascript string backslash quoting in STR, per
#
# https://developer.mozilla.org/en/JavaScript/Guide/Values,_Variables,_and_Literals#String_Literals
#
# Encode::JavaScript::UCS does \u, but not the rest
#
# cf Java as such not quite the same:
# unicode: http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#100850
# strings: http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#101089
#
my %javascript_backslash = ('b' => "\b", # backspace
'f' => "\f", # formfeed
'n' => "\n", # newline
'r' => "\r",
't' => "\t", # tab
'v' => "\013", # vertical tab
);
sub javascript_string_unquote {
my ($str) = @_;
$str =~ s{\\(?:
((?:[0-3]?[0-7])?[0-7]) # $1 \377 octal latin-1
|x([0-9a-fA-F]{2}) # $2 \xFF hex latin-1
|u([0-9a-fA-F]{4}) # $3 \uFFFF hex unicode
|(.) # $4 \n etc escapes
)
}{
(defined $1 ? chr(oct($1))
: defined $4 ? ($javascript_backslash{$4} || $4)
: chr(hex($2||$3))) # \x,\u hex
}egx;
return $str;
}
lib/App/Chart/Texinfo/Util.pm view on Meta::CPAN
# rule 5 remaining spaces become dashes
$node =~ tr/ /-/;
# rule 7 prepend "g_t" if doesn't begin with alpha
if ($node =~ /^[^A-Za-z]/) {
$node = 'g_t' . $node;
}
return $node;
}
# ENHANCE-ME: For EBCDIC presumably a UTF-EBCDIC -> unicode conversion is
# needed here, instead of just ord().
sub _escape_char {
my ($c) = @_; # single-char string
$c = ord($c);
if ($c <= 0xFFFF) {
return sprintf ('_%04x', $c);
} elsif ($c <= 0xFF_FFFF) {
return sprintf ('__%06x', $c);
}
}
1;
__END__
=for stopwords texinfo Texinfo utf unicode
=head1 NAME
App::Chart::Texinfo::Util -- some texinfo utilities
=for test_synopsis my ($anchor, $node)
=head1 SYNOPSIS
use App::Chart::Texinfo::Util;
lib/App/Chart/Texinfo/Util.pm view on Meta::CPAN
Return a HTML anchor for a Texinfo node name, as per anchor generation
specified in the Texinfo manual "HTML Xref Node Name Expansion" and "HTML
Xref 8-bit Character Expansion". It encodes various spaces and
non-alphanumeric characters as hexadecimal "_HHHH" sequences. For example,
App::Chart::Texinfo::Util::node_to_html_anchor ('My Node-Name')
# returns 'My-Node_002dName'
Perl utf8 wide-char strings can be passed here. Characters beyond 255 are
taken to be unicode and encoded as 4 or 6 hex digits per the Texinfo spec.
=back
=head1 SEE ALSO
L<Texinfo::Menus>
=head1 HOME PAGE
L<http://user42.tuxfamily.org/chart/index.html>
lib/App/Chart/Vacuum.pm view on Meta::CPAN
sub vacuum_notes {
my $notes_filename = App::Chart::DBI::notes_filename();
my $notes_oldsize = -s $notes_filename;
App::Chart::Download::status (__x('VACUUM notes.sqdb ({oldsize} bytes)',
oldsize => $notes_oldsize));
require DBI;
my $nbh = DBI->connect ("dbi:SQLite:dbname=$notes_filename",
'', '', {RaiseError=>1});
$nbh->func(90_000, 'busy_timeout'); # 90 seconds
$nbh->{sqlite_unicode} = 1;
$nbh->do ('VACUUM');
my $notes_newsize = -s $notes_filename;
print __x("Notes was {oldsize} now {newsize} bytes\n",
oldsize => $notes_oldsize,
newsize => $notes_newsize);
}
sub vacuum_database {
my $dbh = App::Chart::DBI->instance;
my $database_filename = App::Chart::DBI::database_filename();
lib/App/Chart/doc/chart.html view on Meta::CPAN
<a class="index-entry-id" id="index-Name-translations"></a>
<a class="index-entry-id" id="index-Weblink"></a>
<a id="index-Stock-name-translations"></a><span>Stock and commodity names<a class="copiable-link" href="#index-Stock-name-translations"> ¶</a></span></dt>
<dd><p>Names are downloaded in the selected or highest preference language, when
there’s a choice. Weblinks to company information or the exchange home page
likewise.
</p>
</dd>
<dt><a class="index-entry-id" id="index-UTF_002d8"></a>
<a id="index-Annotation-locale"></a><span>Annotations<a class="copiable-link" href="#index-Annotation-locale"> ¶</a></span></dt>
<dd><p>Annotation notes (see <a class="pxref" href="#Annotations">Annotations</a>) can be entered with unicode characters.
</p>
</dd>
</dl>
<ul class="mini-toc">
<li><a href="#Locale-Selection" accesskey="1">Locale Selection</a></li>
</ul>
<div class="section-level-extent" id="Locale-Selection">
<h3 class="section"><span>17.1 Locale Selection<a class="copiable-link" href="#Locale-Selection"> ¶</a></span></h3>
<a class="index-entry-id" id="index-Locale-selection"></a>
misc/cellview.pl view on Meta::CPAN
my $label = Gtk2::Label->new;
$label->set_markup ('<span gravity="east">hello</span>');
# $label->set (attributes => $attrlist);
# my $context = $label->get_pango_context;
# $toplevel->signal_connect (map_event => sub { $context->set_base_gravity ('east') });
$vbox->pack_start ($label, 1,1,0);
# Create a model object with the data that's going to be shown, in this case
# a Gtk2::ListStore with just one column and with text strings in the rows.
# The "*"s at the start of each item are just a simple visual separator.
# You could use a unicode bullet or whatnot if you're confident of having
# the fonts.
#
my $liststore = Gtk2::ListStore->new ('Glib::String');
foreach my $str ('* Item one',
'* Item two',
'* Item three',
'* Item four',
'* Item five') {
$liststore->set_value ($liststore->append, # append new row
0, # store to column 0
misc/t-listseq.pl view on Meta::CPAN
return 0; # keep walking
});
}
{
# my $dbh = App::Chart::DBI->instance();
require DBI;
unlink ('/tmp/foo.sqdb');
my $dbh = DBI->connect ("dbi:SQLite:dbname=/tmp/foo.sqdb",
'', '', {RaiseError=>1});
$dbh->{sqlite_unicode} = 1;
$dbh->do ('CREATE TABLE symlist (
seq INT NOT NULL,
x INT,
key TEXT,
name TEXT,
condition TEXT DEFAULT NULL,
PRIMARY KEY (x,seq))
');
$dbh->do ('INSERT INTO symlist (seq,key,x) VALUES (0,\'aaa\',44)');
unused/Yahoo-v7.pm view on Meta::CPAN
#------------------------------------------------------------------------------
# undo javascript string backslash quoting in STR, per
#
# https://developer.mozilla.org/en/JavaScript/Guide/Values,_Variables,_and_Literals#String_Literals
#
# Encode::JavaScript::UCS does \u, but not the rest
#
# cf Java as such not quite the same:
# unicode: http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#100850
# strings: http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#101089
#
my %javascript_backslash = ('b' => "\b", # backspace
'f' => "\f", # formfeed
'n' => "\n", # newline
'r' => "\r",
't' => "\t", # tab
'v' => "\013", # vertical tab
);
sub javascript_string_unquote {
my ($str) = @_;
$str =~ s{\\(?:
((?:[0-3]?[0-7])?[0-7]) # $1 \377 octal latin-1
|x([0-9a-fA-F]{2}) # $2 \xFF hex latin-1
|u([0-9a-fA-F]{4}) # $3 \uFFFF hex unicode
|(.) # $4 \n etc escapes
)
}{
(defined $1 ? chr(oct($1))
: defined $4 ? ($javascript_backslash{$4} || $4)
: chr(hex($2||$3))) # \x,\u hex
}egx;
return $str;
}
unused/YahooOld.pm view on Meta::CPAN
}
# (String quoting for parsing of <script> in HTML to get crumb.)
# undo javascript string backslash quoting in STR, per
#
# https://developer.mozilla.org/en/JavaScript/Guide/Values,_Variables,_and_Literals#String_Literals
#
# Encode::JavaScript::UCS does \u, but not the rest
#
# cf Java as such not quite the same:
# unicode: http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#100850
# strings: http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#101089
#
my %javascript_backslash = ('b' => "\b", # backspace
'f' => "\f", # formfeed
'n' => "\n", # newline
'r' => "\r",
't' => "\t", # tab
'v' => "\013", # vertical tab
);
sub javascript_string_unquote {
my ($str) = @_;
$str =~ s{\\(?:
((?:[0-3]?[0-7])?[0-7]) # $1 \377 octal latin-1
|x([0-9a-fA-F]{2}) # $2 \xFF hex latin-1
|u([0-9a-fA-F]{4}) # $3 \uFFFF hex unicode
|(.) # $4 \n etc escapes
)
}{
(defined $1 ? chr(oct($1))
: defined $4 ? ($javascript_backslash{$4} || $4)
: chr(hex($2||$3))) # \x,\u hex
}egx;
return $str;
}