Subject: | cpants.db schema has changed |
Hi Sébastien,
the cpants.db database now uses DBD::SQLite instead of DBD::SQLite2 and the schema has changed slightly. The attached patch corrects the SQL queries used.
The documentation refers to both '$cpandeps' and '$cpandep', so when you cut and paste the example code you get an error. Since the module name itself singular, I chose to rename the occurrences of '$cpandeps' to '$cpandep'.
Sub::Uplevel (I think) caused the code to crash, which is the reason for the addition of ref($deps) eq 'HASH' conditional guard at line 370, and I added a defined guard at line 380 because sometimes $requires can be undef I forget which module causes this, but the error message will say where. I haven't had time to investigate this further.
Also, setting the verbose flag doesn't seem to produce any more, or less, output when it's set or not, at least when using a cpants db.
7c7
< use DBD::SQLite;
---
> use DBD::SQLite2;
39,40c39,40
< my $cpandep = CPAN::Dependency->new(process => ALL_CPAN);
< $cpandep->run; # this may take some time..
---
> my $cpandeps = CPAN::Dependency->new(process => ALL_CPAN);
> $cpandeps->run; # this may take some time..
177c177
< my $cpandep = new CPAN::Dependency verbose => 1,
---
> my $cpandeps = new CPAN::Dependency verbose => 1,
183c183
< my $cpandep = new CPAN::Dependency verbose => 1, process => ALL_CPAN;
---
> my $cpandeps = new CPAN::Dependency verbose => 1, process => ALL_CPAN;
370c370
< unless(defined $deps and ref($deps) eq 'HASH' and keys %$deps) {
---
> unless(defined $deps and keys %$deps) {
381,386c381
< if( not defined $requires ) {
< warn "Don't know how to figure out prereqs from Makefile.PL for $where\n";
< }
< else {
< eval "{ no strict; \$deps = { $requires \n} }";
< }
---
> eval "{ no strict; \$deps = { $requires \n} }";
591c586
< my $dbh = DBI->connect("dbi:SQLite:dbname=$cpants_db", '', '')
---
> my $dbh = DBI->connect("dbi:SQLite2:dbname=$cpants_db", '', '')
595,597c590,592
< SELECT dist.dist, dist.dist_without_version, author.pauseid, author.name
< FROM dist, author
< WHERE author.pauseid=dist.author
---
> SELECT dist.dist, dist.dist_without_version, authors.cpanid, authors.author
> FROM dist, authors
> WHERE authors.cpanid=dist.author
633d627
< $dists_sth->finish;