my $cb      = CPANPLUS::Backend->new;
    my $modobj  = $cb->module_tree('Some::Module');

    ### as an option to ->install()
    $modobj->install( format => 'CPANPLUS::Dist::Deb' ); 

    ### just to create the debs, don't install
    $modobj->install( format => 'CPANPLUS::Dist::Deb',
                      target => 'create',
                      prereq_target => 'create' );

    ### the long way around

    my $deb = CPANPLUS::Dist->new(
                                format  => 'CPANPLUS::Dist::Deb',
                                module  => $modobj,
    $bool   = $deb->create;     # create a .deb file
    $bool   = $deb->install;    # installs the .deb file

    $where  = $deb->status->dist;                   # from the dist obj
    $where  = $modobj->status->dist->status->dist;  # from the mod obj

    ### from the CPANPLUS Default shell
    CPAN Terminal> i --format=CPANPLUS::Dist::Deb Some::Module
    ### using the commandline tool
    cpan2dist --format CPANPLUS::Dist::Deb Some::Module


CPANPLUS::Dist::Deb is a distribution class to create debian packages from CPAN modules, and all it's dependencies. This allows you to have the most recent copies of CPAN modules installed, using your package manager of choice, but without having to wait for central repositories to be updated.

You can either install them using the API provided in this package, or manually via dpkg.

Some of the bleading edge CPAN modules have already been turned into debian packages for you, and you can make use of them by adding the following line to your /etc/apt/sources.list file:

    deb unstable main

Note that these packages are built automatically from CPAN and are assumed to have the same license as perl and come without support. Please always refer to the original CPAN package if you have questions.



Returns the CPANPLUS::Module object that parented this object.


Returns the Object::Accessor object that keeps the status for this module.

Look at CPANPLUS::Dist for a list of standard accessors every Dist::* object will have. Below is a list of those specific to this package.

Note that these are mostly to ensure the inner workings of this package.


All accessors can be accessed as follows: $deb->status->ACCESSOR


The location of the debian/rules file.

Will be removed after successful creation.


The location of the debian/compat file

Will be removed after successful creation.


The location of the debian/changelog file

Will be removed after successful creation.


The location of the debian/copyright file

Will be removed after successful creation.


The location of the debian/control file

Will be removed after successful creation.


The directory where the .deb file is placed.

Will be removed after successful creation.


The location of the .deb file.

Note this is equivalent to the dist accessor already standardly provided.


List of all the generated files for this distribution.


$bool = CPANPLUS::Dist::Deb->format_available();

Returns a boolean indicating whether or not you can use this package to create and install modules in your environment.

It will verify if you have all the necessary components avialable to build your own debian packages. You will need at least these dependencies installed:


$bool = $deb->init

Sets up the CPANPLUS::Dist::Deb object for use. Effectively creates all the needed status accessors.

Called automatically whenever you create a new CPANPLUS::Dist object.

prepare preps a distribution for creation. This means it will create all meta data files required by dpkg-buildpackage to build a .deb file of hte module you specified. This will also satisfy any prerequisites the module may have.

If you set skiptest to true, it will skip the test stage. If you set force to true, it will go over all the stages of the creation process again, ignoring any previously cached results. It will also ignore a bad return value from the test stage and still allow the operation to return true.

Returns true on success and false on failure.

You may then call $deb->create on the object to create the .deb from the metadata, and then $deb->install on the object to actually install it.

Returns the location of the builddir on success, and false on failure.

Note any extra options you pass along, will be passed to the underlying installers verbatim. This enables you to, for example, specify extra flags for the perl Makefile.PL stage.

$loc = $dist->create([force => BOOL, verbose => BOOL, keep_source => BOOL])

create preps a distribution for installation. This means it will build a .deb file of the module object you've specified from the meta data files that were generated during prepare.

Returns true on success and false on failure.

You may then call $deb->install on the object to actually install it. Returns the location of the .deb file on success, and false on failure.

$bool = $deb->install([verbose => BOOL, force => BOOL, dpkg => /path/to/dpkg, dpkg_flags => ["--extra", "--flags"]]);

Installs the .deb using dpkg -i.

Returns true on success and false on failure

$bool = $deb->uninstall([verbose => BOOL, force => BOOL, dpkg => /path/to/dpkg, dpkg_flags => ["--extra", "--flags"]]);

Uninstalls the .deb using dpkg -r.

Returns true on success and false on failure

$loc = CPANPLUS::Dist::Deb->write_meta_files( type => sources|packages, [basedir => /path/to/base, perl => /path/to/perl, release => $releasename]);

This writes the metafiles needed to use this archive as a debian mirror.

It returns the location of the metafile on success, and false on failure.


There are no TODOs of a technical nature currently, merely of an administrative one;

Scan for proper license

Right now we assume that the license of every module is the same as perl itself. Although correct in almost all cases, it should really be probed rather than assumed. This forms a barrier before .debs generated by this package can be used by debian itself in it's own repositories.

Long description

Right now we provided the description as given by the module in it's meta data. However, not all modules provide this meta data and rather than scanning the files in the package for it, we simply default to the name of the module.


This module by Jos Boumans <>.


The CPAN++ interface (of which this module is a part of) is copyright (c) 2005, Jos Boumans <>. All rights reserved.

This library is free software; you may redistribute and/or modify it under the same terms as Perl itself.


CPANPLUS::Backend, CPANPLUS::Module, CPANPLUS::Dist, cpan2dist, dpkg, apt-get