home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / perl / Build.pm < prev    next >
Encoding:
Perl POD Document  |  2004-01-01  |  4.3 KB  |  178 lines

  1. # $File: //depot/cpan/Module-Install/lib/Module/Install/Build.pm $ $Author: ingy $
  2. # $Revision: #23 $ $Change: 1255 $ $DateTime: 2003/03/05 13:23:32 $ vim: expandtab shiftwidth=4
  3.  
  4. package Module::Install::Build;
  5. $VERSION = '0.01';
  6. use strict;
  7. use vars qw(@ISA);
  8. use Module::Install::Base; @ISA = qw(Module::Install::Base);
  9.  
  10. sub Build { $_[0] }
  11.  
  12. sub write {
  13.     my $self = shift;
  14.     die "Build->write() takes no arguments\n" if @_;
  15.  
  16.     my %args;
  17.     my $build;
  18.  
  19.     $args{dist_name} = $self->name || $self->determine_NAME($self->{args});
  20.     $args{license} = $self->license;
  21.     $args{dist_version} = $self->version || $self->determine_VERSION($self->{args});
  22.     $args{dist_abstract} = $self->abstract;
  23.     $args{dist_author} = $self->author;
  24.     $args{sign} = $self->sign;
  25.     $args{no_index} = $self->no_index;
  26.  
  27.     foreach my $key (qw(build_requires requires recommends conflicts)) {
  28.         my $val = eval "\$self->$key" or next;
  29.         $args{$key} = { map @$_, @$val };
  30.     }
  31.  
  32.     %args = map {($_, $args{$_})} grep {defined($args{$_})} keys %args;
  33.  
  34.     require Module::Build;
  35.     $build = Module::Build->new(%args);
  36.     $build->add_to_cleanup(split /\s+/, $self->clean_files);
  37.     $build->create_build_script;
  38. }
  39.  
  40. sub ACTION_reset {
  41.     my ($self) = @_;
  42.     die "XXX - Can't get this working yet";
  43.     require File::Path;
  44.     warn "Removing inc\n";
  45.     rmpath('inc');
  46. }
  47.  
  48. sub ACTION_dist {
  49.     my ($self) = @_;
  50.     die "XXX - Can't get this working yet";
  51. }
  52.  
  53. # <ingy> DrMath: is there an OO way to add actions to Module::Build??
  54. # <DrMath> ingy: yeah
  55. # <DrMath> ingy: package MyBuilder; use w(Module::Build; @ISA = qw(w(Module::Build); sub ACTION_ingy
  56. #           {...}
  57. # <DrMath> ingy: then my $build = new MyBuilder( ...parameters... );
  58. #           $build->write_build_script;
  59.  
  60.  
  61. 1;
  62.  
  63. __END__
  64.  
  65. =head1 NAME
  66.  
  67. Module::Install::Build - Extension Rules for Module::Build
  68.  
  69. =head1 VERSION
  70.  
  71. This document describes version 0.01 of Module::Install::Build, released
  72. March 1, 2003.
  73.  
  74. =head1 SYNOPSIS
  75.  
  76. In your F<Makefile.PL>:
  77.  
  78.     use inc::Module::Install;
  79.     &Build->write;
  80.  
  81. =head1 DESCRIPTION
  82.  
  83. This module is a wrapper around B<Module::Build>.
  84.  
  85. The C<&Build->write> function will pass on keyword/value pair functions
  86. to C<Module::Build::create_build_script>.
  87.  
  88. =head2 VERSION
  89.  
  90. B<Module::Build> requires either the C<VERSION> or C<VERSION_FROM>
  91. parameter.  If this module can guess the package's C<NAME>, it will attempt
  92. to parse the C<VERSION> from it.
  93.  
  94. If this module can't find a default for C<VERSION> it will ask you to
  95. specify it manually.
  96.  
  97. =head1 MAKE TARGETS
  98.  
  99. B<Module::Build> provides you with many useful C<make> targets. A
  100. C<make> B<target> is the word you specify after C<make>, like C<test>
  101. for C<make test>. Some of the more useful targets are:
  102.  
  103. =over 4
  104.  
  105. =item * all
  106.  
  107. This is the default target. When you type C<make> it is the same as
  108. entering C<make all>. This target builds all of your code and stages it
  109. in the C<blib> directory.
  110.  
  111. =item * test
  112.  
  113. Run your distribution's test suite.
  114.  
  115. =item * install
  116.  
  117. Copy the contents of the C<blib> directory into the appropriate
  118. directories in your Perl installation.
  119.  
  120. =item * dist
  121.  
  122. Create a distribution tarball, ready for uploading to CPAN or sharing
  123. with a friend.
  124.  
  125. =item * clean distclean purge
  126.  
  127. Remove the files created by C<perl Makefile.PL> and C<make>.
  128.  
  129. =item * help
  130.  
  131. Same as typing C<perldoc Module::Build>.
  132.  
  133. =back
  134.  
  135. This module modifies the behaviour of some of these targets, depending
  136. on your requirements, and also adds the following targets to your Makefile:
  137.  
  138. =over 4
  139.  
  140. =item * cpurge
  141.  
  142. Just like purge, except that it also deletes the files originally added
  143. by this module itself.
  144.  
  145. =item * chelp
  146.  
  147. Short cut for typing C<perldoc Module::Install>.
  148.  
  149. =item * distsign
  150.  
  151. Short cut for typing C<cpansign -s>, for B<Module::Signature> users to
  152. sign the distribution before release.
  153.  
  154. =back
  155.  
  156. =head1 SEE ALSO
  157.  
  158. L<Module::Install>, L<CPAN::MakeMaker>, L<CPAN::MakeMaker-Philosophy>
  159.  
  160. =head1 AUTHORS
  161.  
  162. Autrijus Tang E<lt>autrijus@autrijus.orgE<gt>
  163.  
  164. Based on original works by Brian Ingerson E<lt>INGY@cpan.orgE<gt>
  165.  
  166. =head1 COPYRIGHT
  167.  
  168. Copyright 2002, 2003, 2004 by
  169. Autrijus Tang E<lt>autrijus@autrijus.orgE<gt>,
  170. Brian Ingerson E<lt>ingy@cpan.orgE<gt>
  171.  
  172. This program is free software; you can redistribute it and/or modify it
  173. under the same terms as Perl itself.
  174.  
  175. See L<http://www.perl.com/perl/misc/Artistic.html>
  176.  
  177. =cut
  178.