ACME-QuoteDB
view release on metacpan or search on metacpan
0.1.2 Wed Sep 30 23:26:11 PDT 2009
bug fixes:
* Build.PL install changes - SQLite3 could not actually write to the database,
even though, the db file was world writeable. The container dir
also needs to be writable, now it is.
* ensure the database is 0666 for tests as well
0.1.1 Fri Sep 18 02:11:02 PDT 2009
bug fixes:
* default constructor values were not getting set on the object as they should
* loosen untaint filepath - for the dist test failures
0.1.0 Wed Sep 9 23:43:56 PDT 2009
Initial public pre-release (minor version)
lib/ACME/QuoteDB.pm view on Meta::CPAN
else {
if ($qc_obj->catg_id eq $catg_ids){
# use cat_id if already exists
push @{$quote_ids}, $qc_obj->quot_id;
}
}
}
return $quote_ids;
}
sub _untaint_data {
my ($arr_ref) = @_;
my $ut_ref = ();
foreach my $q (@{$arr_ref}){
if ($q =~ m{\A([0-9]+)\z}sm){
push @{$ut_ref}, $1;
}
}
return $ut_ref;
}
lib/ACME/QuoteDB.pm view on Meta::CPAN
}
if ($source) {
$source =~ s{'}{''}gsm; # sql escape single quote
$source = qq/ AND source = '$source' /;
}
my $qids = q{};
if ($catgs) {
$catgs = _get_ids_if_catgs_exist($catgs);
my $qid_ref = _get_quote_id_from_catg_id($catgs);
$qids = join ',', @{_untaint_data($qid_ref)};
$qids = qq/ AND quot_id IN ($qids) /;
}
($lower, $upper) = _get_if_rating($lower, $upper);
if ($contain) { $contain = qq/ AND quote LIKE '%$contain%' / }
if ($limit) { $limit = qq/ LIMIT '$limit' / };
my @q = Quote->retrieve_from_sql(
qq{ $attr_name $lower $upper $source $qids $contain $limit },
lib/ACME/QuoteDB/DB/DBI.pm view on Meta::CPAN
use version; our $VERSION = qv('0.1.2');
use Readonly;
use File::Basename qw/dirname/;
use Carp qw/croak/;
use Cwd 'abs_path';
use File::Spec;
Readonly my $QUOTES_DATABASE => $ENV{ACME_QUOTEDB_PATH}
|| File::Spec->catfile(_untaint_db_path(),
q(quotedb), q(quotes.db)
);
# set this to use a remote database
# i.e. mysql
Readonly my $REMOTE => $ENV{ACME_QUOTEDB_REMOTE};
# be more specific (or more general) this is mysql
# and 'remote' can be localhost
if ($REMOTE && $REMOTE ne 'mysql') {
lib/ACME/QuoteDB/DB/DBI.pm view on Meta::CPAN
# how to enable this function?
#ACME::QuoteDB::DB::DBI->set_sql(func( 3600000, 'busy_timeout' );
}
sub get_current_db_path {
return $QUOTES_DATABASE;
}
sub _untaint_db_path {
my $sane_path = abs_path(dirname(__FILE__));
# appease taint mode, what a dir path looks like,... (probably not)
$sane_path =~ m{([a-zA-Z0-9-_\.:\/\\\s]+)}; #add '.', ':' for win32
return $1 || croak 'cannot untaint db path';
}
1;
__END__
=head1 NAME
ACME::QuoteDB::DB::DBI - DBI For ACME::QuoteDB
t/data/python_quotes.txt view on Meta::CPAN
decks: one at least got something back if there were too many )s.
-- John W. Baxter, 21 May 2000
Python: embodies a harmony of chocolate kisses with hints of jasmine and rose.
Trussardi's wild new fragrance.
-- From _Marie Claire_, Australian edition, May 2000; noted by Fiona
Czuczman
In arts, compromises yield mediocre results. The personality and vision of the
artist has to go through. I like to see Python as a piece of art. I just hope
the artist will not get too tainted by usability studies.
-- François Pinard, 22 May 2000
In fact, I've never seen an argument about which I cared less. I'm completely
case insensitivity insensitive.
-- William Tanksley, 23 May 2000
They boo-ed when Dylan went electric. But for me its about the instincts of a
designer, and the faith of a fan. Not science. So much the better.
-- Arthur Siegel, 23 May 2000
( run in 0.321 second using v1.01-cache-2.11-cpan-d6f9594c0a5 )