| Module-Packaged-Generator documentation | Contained in the Module-Packaged-Generator distribution. |
Module::Packaged::Generator - build list of modules packaged by a linux distribution
version 1.111040
This module alows to fetch modules available as native Linux (or BSD) distribution packages, and wraps them in a sqlite database. This allows people to do analysis, draw CPANTS metrics from it or whatever.
Of course, running the utility shipped in this dist will only create the database for the current distribution. But that's not our job to do crazy manipulation with this data, we just provide the data :-)
my @drivers = Module::Packaged::Generator->all_drivers();
Return a list of all available drivers supporting a distribution. The list is a list of module names (strings) such as Module::Packaged::Generator::Mandriva.
my $driver = Module::Packaged::Generator->find_driver;
Return a driver that can be used on the current machine, or undef if no suitable driver was found.
my $dbh = Module::Packaged::Generator->create_db($file);
Creates a sqlite database with the correct schema. Remove the previous
$file if it exists. Return the handler on the opened database.
You can find more information on this module at:
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Module-Packaged-Generator
Jerome Quelin
This software is copyright (c) 2010 by Jerome Quelin.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
| Module-Packaged-Generator documentation | Contained in the Module-Packaged-Generator distribution. |
# # This file is part of Module-Packaged-Generator # # This software is copyright (c) 2010 by Jerome Quelin. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use 5.008; use strict; use warnings; package Module::Packaged::Generator; BEGIN { $Module::Packaged::Generator::VERSION = '1.111040'; } # ABSTRACT: build list of modules packaged by a linux distribution use DBI; use List::Util qw{ first }; use Module::Pluggable require => 1, sub_name => 'dists', search_path => __PACKAGE__.'::Distribution'; # -- public methods sub all_drivers { return $_[0]->dists; } sub find_driver { my $self = shift; return first { $_->match } $self->dists; } sub create_db { my ($self, $file) = @_; unlink($file) if -f $file; my $dbh = DBI->connect("dbi:SQLite:dbname=$file", '', ''); $dbh->do(" CREATE TABLE module ( module TEXT NOT NULL, version TEXT, dist TEXT, pkgname TEXT NOT NULL ); "); return $dbh; } 1;
__END__