Build

Table of Contents

NAME
Synopsis
Description
Constructor and initialization
Method: build('Some::Module')
Method: generate_announcement('Some::Module')
Method: generate_readme('Some::Module')
Method: install('Some::Module')
Method: log($s)
Method: module_names()
Method: real_clean('Some::Module')
Method: report_install_errors('Installer name', 'File name')
Method: test_build('Some::Module')
Required Modules
Resources
Author
Copyright

Build

NAME

Local::Build - My Local module Builder

Synopsis

	#!/usr/bin/perl
	use lib "$ENV{'INSTALL'}/lib";
	use lib "$ENV{'INSTALL'}/lib/perl5";
	use strict;
	use warnings;
	use Local::Build;
	use Local::Config;
	# ----------------
	my($config)	= Local::Config::get_config();
	my($build)	= Local::Build -> new
	(
		install_dir      => $ENV{'INSTALL'}, # Unix only.
		post_install_dir => "$$config{'module_dir'}/manual",
		uninstall        => 0,
		verbose          => 1,
	);
	for (grep{! /^$/} map{s/^(.*?)#(.*)$/$1/; s/^\s+//; s/\s+$//; $_} <DATA>)
	{
		last if (/__END__/);
		$build -> install($_);
	}
	# Notes:
	# o If module B depends on module A, list A first, then B.
	__DATA__
	Local::Config
	Local::CheckDistro
	Local::Run3
	Local::Build
	__END__
	Local::Killer::App

Description

Local::Build is a pure Perl module.

Constructor and initialization

new(...) returns a Local::Build object.

This is the class's contructor.

Usage: Local::Build -> new().

new() takes various parameters.

  • install_dir

    The directory into which the Perl modules will be installed.

    GNU only. Under Windows they go into /perl/site/lib/.

    Default value is the empty string.

    This parameter is optional.

  • post_install_dir

    The directory into which the Perl modules will be moved after being installed.

    Typical values:

    • "$$config{'module_dir'}/auto"

      See examples/auto.pl.

    • "$$config{'module_dir'}/manual"

      See examples/manual.pl.

    • "$$config{'module_dir'}/mine"

      See examples/mine.pl.

    The parameter is mandatory.

  • uninstall

    Takes values of 0 or 1.

    If 0, do not uninstall any previous version(s?) of the module being installed.

    If 1, zap 'em.

    Defaults to 1.

    You would set this parameter to 0 when installing modules in your own directory under Unix, and you did not have permission to unlink the system version of the same module, or you wish to preserve the previous version.

    You can recognize the former case when you get an error message such as:

    	Cannot forceunlink /usr/lib/perl5/5.6.1/i386-linux/auto/Data/Dumper/Dumper.so:
    	Permission denied at /usr/lib/perl5/5.6.1/File/Find.pm line 495

    If you are re-installing one of the modules in your own directory, then it doesn't matter if the value of this option is 0 or 1, because the install will overwrite the previous version anyway, without an explicit uninstall.

    The parameter is optional.

  • verbose

    Specify whether or not to print progress messages.

    Default: 0.

    The parameter is optional.

Method: build('Some::Module')

Returns nothing.

Given a module_dir from the config file, and a distro dir within the module_dir, with a module waiting to be converted into a distro within that distro dir, build the distro.

E.g.:

  • GNU/Linux
    	Given /home/ron/perl-modules/
    	and   /home/ron/perl-modules/Killer-App-1.00/
    	then build Killer-App-1.00.tgz and Killer-App-1.00.zip in the latter directory
  • Windows
    	Given d:\perl-modules
    	and   d:\perl-modules\Killer-App-1.00
    	then build Killer-App-1.00.tgz and Killer-App-1.00.zip in the latter directory

Method: generate_announcement('Some::Module')

Returns nothing.

Given the dirs as listed under build(), create announce.txt in the distro's dir.

Note: Check for an existing distro file in module_dir before proceeding.

Method: generate_readme('Some::Module')

Returns nothing.

Given the dirs as listed under build(), create README in the distro's dir.

Note: Check for an existing distro file in module_dir before proceeding. This means you must use a dummy README to create the distro, and the unpack it, and then use this method to create the correct README file, and then you recreate the distro...

Method: install('Some::Module')

Returns nothing.

Given a module_dir from the config file, and a distro within the module_dir, install the module.

Note: If there are other versions of the same module laying about, I move them into ./misc/.

Method: log($s)

Returns nothing.

Append $s to the log buffer.

Conveniently, $s can contain embedded new-lines.

Method: module_names()

Returns a sorted array ref of module names in 'Some::Module' format.

This array ref will not contain duplicates.

Method: real_clean('Some::Module')

Returns nothing.

Change dir into a module's distro dir and delete lots of files.

Method: report_install_errors('Installer name', 'File name')

Returns nothing.

Read the source of the installer, e.g. auto/manual/mine.pl, and read the log of running the installed, and use the names of the modules being installed, from the installer, to find interesting things in the log.

Method: test_build('Some::Module')

Returns nothing.

Try building a module.

Required Modules

  • Carp
  • Cwd
  • File::Copy
  • File::Path
  • HTML::Template
  • Local::CheckDistro
  • Local::Run3
  • Path::Class

Resources

http://savage.net.au/Perl-modules/html/local-module-overview.html

Author

Local::Build was written by Ron Savage in 2004.

Home page: http://savage.net.au/index.html

Copyright

Australian copyright © 2004, Ron Savage. All rights reserved.

	All Programs of mine are 'OSI Certified Open Source Software';
	you can redistribute them and/or modify them under the terms of
	The Artistic License, a copy of which is available at:
	http://www.opensource.org/licenses/index.html
 
Top of page