DhMakePerl - create Debian source package from CPAN dist


DhMakePerl documentation Contained in the DhMakePerl distribution.

Index


Code Index:

NAME

Top

DhMakePerl - create Debian source package from CPAN dist

VERSION

Top

Version 0.72

SYNOPSIS

Top

    use DhMakePerl;

    DhMakePerl->run;

ACCESSORS

Top

apt_contents

Stores the cached copy of Debian::AptContents.

cfg

Stores the configuration, an instance of DhMakePerl::Config

CLASS METHODS

Top

run( %init )

Runs DhMakePerl.

Unless the %init contains an cfg member, constructs and instance of DhMakePerl::Config and assigns it to $init{cfg}.

Then determines the dh-make-perl command requested (via cfg->command), loads the appropriate DhMakePerl::Command::$command class, constructs an instance of it and calls its execute method.

get_apt_contents

Returns (possibly cached) instance of Debian::AptContents.

COPYRIGHT & LICENSE

Top


DhMakePerl documentation Contained in the DhMakePerl distribution.
package DhMakePerl;

use warnings;
use strict;
use 5.010;    # we use smart matching

use base 'Class::Accessor';

__PACKAGE__->mk_accessors( qw( cfg apt_contents ) );

our $VERSION = '0.72';

use Debian::AptContents ();
use DhMakePerl::Config;
use version          ();

sub run {
    my ( $class, %c ) = @_;

    unless ( $c{cfg} ) {
        my $cfg = DhMakePerl::Config->new;
        $cfg->parse_command_line_options;
        $cfg->parse_config_file;
        $c{cfg} = $cfg;
    }

    my $cmd_mod = $c{cfg}->command;
    $cmd_mod =~ s/-/_/g;
    require "DhMakePerl/Command/$cmd_mod.pm";

    $cmd_mod =~ s{/}{::}g;
    $cmd_mod = "DhMakePerl::Command::$cmd_mod";

    my $self = $cmd_mod->new( \%c );

    return $self->execute;
}

sub get_apt_contents {
    my $self = shift;

    return $self->apt_contents
        if $self->apt_contents;

    my $apt_c = Debian::AptContents->new(
        {   homedir      => $self->cfg->home_dir,
            dist         => $self->cfg->dist,
            sources      => $self->cfg->sources_list,
            verbose      => $self->cfg->verbose,
            contents_dir => $self->cfg->apt_contents_dir,
        }
    );

    undef $apt_c unless $apt_c->cache;

    return $self->apt_contents($apt_c);
}

1; # End of DhMakePerl