Module-Build

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


 - Made ModuleInfo's _evaluate_version_line() compatible with 'use
   version ...$VERSION' lines.  [Eric Wilhelm]

 - Added some verbiage in Module::Build::API that officially blesses
   the _build/prereqs file for external consumption. [Suggested by Andreas Koenig]

 - Added test profiles support via the test_types property and "testall"
   target. [Eric Wilhelm, Jeff Lavallee]

 - Use syscopy() on OS/2 in copy_if_modified() so we make sure to
   overwrite any existing target file. [Ilya Zakharevich]

 - Removed seemingly silly '~~' test in t/tilde.t.

 - In our test-time utility library t/lib/MBTest.pm, we need to know
   about a few .exe-like extensions on OS/2. [Ilya Zakharevich]

 - In t/ppm.t, use DynaLoader::mod2fname() (if available) to determine
   the correct translation of our test module's name into a DLL
   name. [Ilya Zakharevich]

Changes  view on Meta::CPAN

   tests on a previously-installed version of a distribution.

 * Instead of storing an entire dump of the Config.pm hash in the
   _build/ directory upon startup, we now just store any overrides the
   user or author has specified.  Note that if you were doing anything
   you weren't supposed to be doing, like poking around in the
   internals of $buld->{config}, your code might break, so I've put
   the asterisk of incompatibility on this one just to cover my
   tuchus.  [Idea originally by Randy Sims]

 - Made copying files via copy_if_modified() a little less chatty.

0.2805  Sat Jul 29 22:01:24 CDT 2006

 - We now embed a copy of version.pm right in the
   Module::Build::Version source code, with John Peacock's blessing,
   in case the user has a rough time installing version.pm.  This
   helps alleviate troubles people were still having with working out
   a seemingly circular dependency (even though version.pm now ships
   with a standard Makefile.PL too).  A version.pm >= 0.661 installed
   on the system will take precedence over our bundled one. [John

Changes  view on Meta::CPAN

   searched. [Spotted by David Golden]

 - Split the API documentation out of Module::Build::Authoring into
   its own document: Module::Build::API.

 - We should not emit a warning if a Module::Build subclass is
   required in a Makefile.PL that is not bundled in the current
   distribution; it may be installed on the user's system. [Spotted by
   Tyler MacDonald]

 - copy_if_modified() now preserves the executable bit of the source
   file. [Spotted by Julian Mehnle]

 - Fixed compatibility of our screen-scraping the Test::Harness output
   so we can recognize the most recent Test::Harness version. [Steve
   Hay]

 - Backing out a requirement added in 0.27_06 on the method y_n()
   to always include a default. This behavior would cause existing
   build scripts to start failing. We now fail with a missing default
   only when $ENV{PERL_MM_USE_DEFAULT} is set because there is no

Changes  view on Meta::CPAN


 - Changed the split_like_shell() method to use the shellwords()
   function from Text::ParseWords (a core module since 5.0), which
   does a much better job than the split() we were using.

 - Added a 'testpod' action, which checks the syntactic validity of
   all POD files in the distribution using Test::Pod.  This eliminates
   the need for doing so in a regression test. [Initial patch by Mark
   Stosberg]

 - Added a process_files_by_extension() method, which generalizes the
   kind of processing (essentially just copying) that happens for .pm
   and .pod files, and makes it available to other user-defined types
   of files.  See the new cookbook entry.

 - Improved compatibility with version.pm when authors are using
   version objects as their $VERSION variables.  Now
   version_from_file() can deal with these objects.  Currently we
   stringify them right away, but perhaps in the future we will
   preserve them as objects for a while.

lib/Module/Build/API.pod  view on Meta::CPAN


[version 0.20]

[Deprecated] Please see L<Module::Metadata> instead.

Returns true if the given file appears to contain POD documentation.
Currently this checks whether the file has a line beginning with
'=pod', '=head', or '=item', but the exact semantics may change in the
future.

=item copy_if_modified(%parameters)

[version 0.19]

Takes the file in the C<from> parameter and copies it to the file in
the C<to> parameter, or the directory in the C<to_dir> parameter, if
the file has changed since it was last copied (or if it doesn't exist
in the new location).  By default the entire directory structure of
C<from> will be copied into C<to_dir>; an optional C<flatten>
parameter will copy into C<to_dir> without doing so.

lib/Module/Build/Base.pm  view on Meta::CPAN

  my $blib = $self->blib;
  $self->add_to_cleanup($blib);
  File::Path::mkpath( File::Spec->catdir($blib, 'arch') );

  if (my $split = $self->autosplit) {
    $self->autosplit_file($_, $blib) for ref($split) ? @$split : ($split);
  }

  foreach my $element (@{$self->build_elements}) {
    my $method = "process_${element}_files";
    $method = "process_files_by_extension" unless $self->can($method);
    $self->$method($element);
  }

  $self->depends_on('config_data');
}

sub ACTION_build {
  my $self = shift;
  $self->log_info("Building " . $self->dist_name . "\n");
  $self->depends_on('code');
  $self->depends_on('docs');
}

sub process_files_by_extension {
  my ($self, $ext) = @_;

  my $method = "find_${ext}_files";
  my $files = $self->can($method) ? $self->$method() : $self->_find_file_by_type($ext,  'lib');

  foreach my $file (sort keys %$files) {
    $self->copy_if_modified(from => $file, to => File::Spec->catfile($self->blib, $files->{$file}) );
  }
}

sub process_support_files {
  my $self = shift;
  my $p = $self->{properties};
  return unless $p->{c_source};
  return if $self->pureperl_only && $self->allow_pureperl;

  my $files;

lib/Module/Build/Base.pm  view on Meta::CPAN

sub process_share_dir_files {
  my $self = shift;
  my $files = $self->_find_share_dir_files;
  return unless $files;

  # root for all File::ShareDir paths
  my $share_prefix = File::Spec->catdir($self->blib, qw/lib auto share/);

  # copy all share files to blib
  foreach my $file (sort keys %$files) {
    $self->copy_if_modified(
      from => $file, to => File::Spec->catfile( $share_prefix, $files->{$file} )
    );
  }
}

sub _find_share_dir_files {
  my $self = shift;
  my $share_dir = $self->share_dir;
  return unless $share_dir;

lib/Module/Build/Base.pm  view on Meta::CPAN


sub process_xs_files {
  my $self = shift;
  return if $self->pureperl_only && $self->allow_pureperl;
  my $files = $self->find_xs_files;
  croak 'Can\'t build xs files under --pureperl-only' if %$files && $self->pureperl_only;
  foreach my $from (sort keys %$files) {
    my $to = $files->{$from};
    unless ($from eq $to) {
      $self->add_to_cleanup($to);
      $self->copy_if_modified( from => $from, to => $to );
    }
    $self->process_xs($to);
  }
}

sub process_pod_files { shift()->process_files_by_extension(shift()) }
sub process_pm_files  { shift()->process_files_by_extension(shift()) }

sub process_script_files {
  my $self = shift;
  my $files = $self->find_script_files;
  return unless keys %$files;

  my $script_dir = File::Spec->catdir($self->blib, 'script');
  File::Path::mkpath( $script_dir );

  foreach my $file (sort keys %$files) {
    my $result = $self->copy_if_modified($file, $script_dir, 'flatten') or next;
    $self->fix_shebang_line($result) unless $self->is_vmsish;
    $self->make_executable($result);
  }
}

sub find_PL_files {
  my $self = shift;
  if (my $files = $self->{properties}{PL_files}) {
    # 'PL_files' is given as a Unix file spec, so we localize_file_path().

lib/Module/Build/Base.pm  view on Meta::CPAN

    my $files = $self->rscan_dir( $dir );
    foreach my $file ( @$files ) {
      next unless -f $file;
      my $rel_file =
        File::Spec->abs2rel( File::Spec->rel2abs( $file ),
                             File::Spec->rel2abs( $dir  ) );
      my $to_file  =
        File::Spec->catfile( $ppm, 'blib',
                            exists( $types{$type} ) ? $types{$type} : $type,
                            $rel_file );
      $self->copy_if_modified( from => $file, to => $to_file );
    }
  }

  foreach my $type ( qw(bin lib) ) {
    $self->htmlify_pods( $type, File::Spec->catdir($ppm, 'blib', 'html') );
  }

  # create a tarball;
  # the directory tar'ed must be blib so we need to do a chdir first
  my $target = File::Spec->catfile( File::Spec->updir, $ppm );

lib/Module/Build/Base.pm  view on Meta::CPAN

  $self->log_warn("*** Did you forget to add $metafile to the MANIFEST?\n")
    unless exists $dist_files->{$metafile};

  my $dist_dir = $self->dist_dir;
  $self->delete_filetree($dist_dir);
  $self->log_info("Creating $dist_dir\n");
  $self->add_to_cleanup($dist_dir);

  foreach my $file (sort keys %$dist_files) {
    next if $file =~ m{^MYMETA\.}; # Double check that we skip MYMETA.*
    my $new = $self->copy_if_modified(from => $file, to_dir => $dist_dir, verbose => 0);
  }

  $self->do_create_bundle_inc if @{$self->bundle_inc};

  $self->_sign_dir($dist_dir) if $self->{properties}{sign};
}

sub ACTION_disttest {
  my ($self) = @_;

lib/Module/Build/Base.pm  view on Meta::CPAN


  my $status = system(@cmd);
  if ($status and $! =~ /Argument list too long/i) {
    my $env_entries = '';
    foreach (sort keys %ENV) { $env_entries .= "$_=>".length($ENV{$_})."; " }
    warn "'Argument list' was 'too long', env lengths are $env_entries";
  }
  return !$status;
}

sub copy_if_modified {
  my $self = shift;
  my %args = (@_ > 3
              ? ( @_ )
              : ( from => shift, to_dir => shift, flatten => shift )
             );
  $args{verbose} = !$self->quiet
    unless exists $args{verbose};

  my $file = $args{from};
  unless (defined $file and length $file) {
    die "No 'from' parameter given to copy_if_modified";
  }

  # makes no sense to replicate an absolute path, so assume flatten
  $args{flatten} = 1 if File::Spec->file_name_is_absolute( $file );

  my $to_path;
  if (defined $args{to} and length $args{to}) {
    $to_path = $args{to};
  } elsif (defined $args{to_dir} and length $args{to_dir}) {
    $to_path = File::Spec->catfile( $args{to_dir}, $args{flatten}
                                    ? File::Basename::basename($file)
                                    : $file );
  } else {
    die "No 'to' or 'to_dir' parameter given to copy_if_modified";
  }

  return if $self->up_to_date($file, $to_path); # Already fresh

  {
    local $self->{properties}{quiet} = 1;
    $self->delete_filetree($to_path); # delete destination if exists
  }

  # Create parent directories

t/files.t  view on Meta::CPAN


use DistGen;
my $dist = DistGen->new( dir => $tmp );
$dist->regen;

$dist->chdir_in;

my $mb = Module::Build->new_from_context;

{
  # Make sure copy_if_modified() can handle spaces in filenames

  my @tmp;
  push @tmp, MBTest->tmpdir for (0 .. 1);

  my $filename = 'file with spaces.txt';

  my $file = File::Spec->catfile($tmp[0], $filename);
  open(my $fh, '>', $file) or die "Can't create $file: $!";
  print $fh "Foo\n";
  close $fh;
  ok -e $file;


  my $file2 = $mb->copy_if_modified(from => $file, to_dir => $tmp[1]);
  ok $file2;
  ok -e $file2;
}

{
  # Try some dir_contains() combinations
  my $first  = File::Spec->catdir('', 'one', 'two');
  my $second = File::Spec->catdir('', 'one', 'two', 'three');

  ok( Module::Build->dir_contains($first, $second) );

t/install_extra_target.t  view on Meta::CPAN


my $subclass = Module::Build->subclass(code => <<'=EOF=');
sub copy_files
{
	my $self = shift;
	my $dir = shift;

	my $files = $self->rscan_dir($dir, sub {-f $_ and not m!/\.|[#~]$!});

	foreach my $file (@$files) {
		$self->copy_if_modified(from => $file, to_dir => "blib");
	}
}

#Copy etc files to blib
sub process_etc_files
{
	my $self = shift;

	$self->copy_files("etc");
}



( run in 0.297 second using v1.01-cache-2.11-cpan-2b0bae70ee8 )