ACME-QuoteDB
view release on metacpan or search on metacpan
my $class = Module::Build->subclass(code => <<'EOF');
use File::Spec;
use File::Copy;
use File::Basename qw/dirname/;
sub process_db_files {
my $self = shift;
my $qdb = File::Spec->catfile(qw(lib ACME QuoteDB DB quotedb), 'quotes.db');
my $_t = File::Spec->catfile(qw(blib lib ACME QuoteDB DB quotedb), 'quotes.db');
mkdir dirname($_t);
chmod(0777, dirname($_t));
copy($qdb, $_t);
chmod(0666, $_t);
}
sub ACTION_install {
my $self = shift;
$self->SUPER::ACTION_install(@_);
my $ddir = $self->install_destination('lib');
#TODO give user choices about installing the quotes database
#my $ques = 'Where do you want to install the quotes database?';
#my $quote_dest = $self->prompt($ques, $ddir);
$db =
File::Spec->catfile($ddir, 'ACME', 'QuoteDB', 'DB', 'quotedb', 'quotes.db');
}
##chown('THIS_UNIX_USER' $db);
## prompt for the chown
# XXX we need to change/fix this
# ideas, let installer/user decide
# create a new system user
# others?
## create quotes db as world writable,... yikes
chmod($d_perms, dirname($db));
chmod($perms, $db);
}
EOF
my $builder = $class->new(
module_name => 'ACME::QuoteDB',
license => 'perl',
dist_author => 'David Wright <david_v_wright@yahoo.com>',
dist_version_from => 'lib/ACME/QuoteDB.pm',
build_requires => {
lib/ACME/QuoteDB.pm view on Meta::CPAN
if you are running perl > 5.8.5 and have access to
install cpan modules, you should have no problem installing this module
(utf-8 support in DBD::SQLite not avaible until 5.8 - we don't support 'non
utf-8 mode)
=over 1
=item * By default, the quotes database used by this module installs in the
system path, 'lib', (See L<Module::Build/"INSTALL PATHS">)
as world writable - i.e. 0666 (and probably owned by root)
If you don't like this, you can modify Build.PL to not chmod the file and it
will install as 444/readonly, you can also set a chown in there for whoever
you want to have RW access to the quotes db.
Alternativly, one can specify a location to a quotes database (file) to use.
(Since the local mode is sqlite3, the file doesn't even need to exist, just
needs read/write access to the path on the filesystem)
Set the environmental variable:
$ENV{ACME_QUOTEDB_PATH} (untested on windows)
lib/ACME/QuoteDB/LoadDB.pm view on Meta::CPAN
if you are running perl > 5.8.5 and have access to
install cpan modules, you should have no problem installing this module
(utf-8 support in Text::CSV not avaible until 5.8 - we don't support 'non
utf-8 mode)
=over 1
=item * By default, the quotes database used by this module installs in the
system path, 'lib', (See L<Module::Build/"INSTALL PATHS">)
as world writable - i.e. 0666 (and probably owned by root)
If you don't like this, you can modify Build.PL to not chmod the file and it
will install as 444/readonly, you can also set a chown in there for whoever
you want to have RW access to the quotes db.
Alternativly, one can specify a location to a quotes database (file) to use.
(Since the local mode is sqlite3, the file doesn't even need to exist, just
needs read/write access to the path)
Set the environmental variable:
$ENV{ACME_QUOTEDB_PATH} (untested on windows)
t/02-get_quotes.t view on Meta::CPAN
BEGIN {
eval "use DBD::SQLite";
$@ and croak 'DBD::SQLite is a required dependancy';
}
#make test db writeable
sub make_test_db_rw {
use ACME::QuoteDB::DB::DBI;
# yeah, this is supposed to be covered by the build process
# but is failing sometimes,...
chmod 0666, ACME::QuoteDB::DB::DBI->get_current_db_path;
}
{
make_test_db_rw;
my $q = File::Spec->catfile((dirname(__FILE__),'data'), 'simpsons_quotes.csv');
my $load_db = ACME::QuoteDB::LoadDB->new({
file => $q,
file_format => 'csv',
create_db => 1, # first run, create the db
t/04-get_quotes_more.t view on Meta::CPAN
"\nPeter: That I wouldn't drink at the stag party." .
"\nLois: And what did you do?" .
"\nPeter: Drank at the stag pa-- ... Whoa. I almost walked into that one.";
{
#make test db writeable
use ACME::QuoteDB::DB::DBI;
# yeah, this is supposed to be covered by the build process
# but is failing sometimes,...
chmod 0666, ACME::QuoteDB::DB::DBI->get_current_db_path;
my $q = File::Spec->catfile((dirname(__FILE__),'data'),
'simpsons_quotes.csv'
);
my $load_db = ACME::QuoteDB::LoadDB->new({
file => $q,
file_format => 'csv',
create_db => 1,
});
t/04-load_get_quote_utf8.t view on Meta::CPAN
'ÎÏοÏÏ Î½Î± ÏÎ¬Ï ÏÏαÏμÎνα γÏ
αλιά ÏÏÏÎ¯Ï Î½Î± ÏÎ¬Î¸Ï ÏίÏοÏα.',
'मà¥à¤ à¤à¤¾à¤à¤ à¤à¤¾ सà¤à¤¤à¤¾ हà¥à¤, मà¥à¤à¥ à¤à¤¸ सॠà¤à¥à¤ पà¥à¤¡à¤¾ नहà¥à¤ हà¥à¤¤à¥.',
'×× × ×××× ××××× ×××××ת ××× ×× ××××§ ××',
];# any takers for specifying each multibyte code sequence for the above,.. ;)
{
#make test db writeable
use ACME::QuoteDB::DB::DBI;
# yeah, this is supposed to be covered by the build process
# but is failing sometimes,...
chmod 0666, ACME::QuoteDB::DB::DBI->get_current_db_path;
my $q = File::Spec->catfile((dirname(__FILE__),'data'),
'utf8.csv'
);
my $load_db = ACME::QuoteDB::LoadDB->new({
file => $q,
file_format => 'csv',
delimiter => "\t",
create_db => 1
});
( run in 0.355 second using v1.01-cache-2.11-cpan-496ff517765 )