22303868b5dd0bda933835b87fcb4f43298dd019
[p5sagit/Devel-Size.git] / inc / Module / Install / Build.pm
1 #line 1
2 package Module::Install::Build;
3
4 use strict;
5 use Module::Install::Base;
6
7 use vars qw{$VERSION $ISCORE @ISA};
8 BEGIN {
9         $VERSION = '0.64';
10         $ISCORE  = 1;
11         @ISA     = qw{Module::Install::Base};
12 }
13
14 sub Build { $_[0] }
15
16 sub write {
17     my $self = shift;
18     die "Build->write() takes no arguments\n" if @_;
19
20     my %args;
21     my $build;
22
23     $args{dist_name}     = $self->name || $self->determine_NAME($self->{args});
24     $args{license}       = $self->license;
25     $args{test_files}    = $self->tests;
26     $args{dist_version}  = $self->version || $self->determine_VERSION($self->{args});
27     $args{dist_abstract} = $self->abstract;
28     $args{dist_author}   = $self->author;
29     $args{sign}          = $self->sign;
30     $args{no_index}      = $self->no_index;
31
32     foreach my $key (qw(build_requires requires recommends conflicts)) {
33         my $val = eval "\$self->$key" or next;
34         $args{$key} = { map @$_, @$val };
35     }
36
37     %args = map {($_, $args{$_})} grep {defined($args{$_})} keys %args;
38
39     require Module::Build;
40     $build = Module::Build->new(%args);
41     $build->add_to_cleanup(split /\s+/, $self->clean_files);
42     $build->create_build_script;
43 }
44
45 sub ACTION_reset {
46     my ($self) = @_;
47     die "XXX - Can't get this working yet";
48     require File::Path;
49     warn "Removing inc\n";
50     rmpath('inc');
51 }
52
53 sub ACTION_dist {
54     my ($self) = @_;
55     die "XXX - Can't get this working yet";
56 }
57
58 # <ingy> DrMath: is there an OO way to add actions to Module::Build??
59 # <DrMath> ingy: yeah
60 # <DrMath> ingy: package MyBuilder; use w(Module::Build; @ISA = qw(w(Module::Build); sub ACTION_ingy
61 #           {...}
62 # <DrMath> ingy: then my $build = new MyBuilder( ...parameters... );
63 #           $build->write_build_script;
64
65 1;
66
67 __END__
68
69 #line 180