NAME

Alien::SWIG - Provides installation and config information for SWIG

SYNOPSIS

use Alien::SWIG;

my $swig       = Alien::SWIG->new();

my $path       = $swig->path();
my $version    = $swig->version();
my $executable = $swig->executable();
my $includes   = $swig->includes();
my $module_dir = $swig->module_dir();
my $cmd_line   = $swig->cmd_line();

DESCRIPTION

This module automates the installation of SWIG - The Simplified Wrapper and Interface Generator, building from source code (downloading if necessary), and provides accessor functions to describe its location, module paths, etc.

This module comes distributed with and installs SWIG version 2.0.1 by default, but you can specify a different version to build and install, and it will do its best to find, download, build, and install that version, as long as it's available in the SWIG SourceForge repository.

To specify an alternate version, use the --swigver=X.X.X argument, e.g.:

perl Build.PL --swigver=1.3.40
./Build
./Build test
./Build install

This would download swig-1.3.40.tar.gz and build and install that, instead.

This module has been tested with SWIG versions 1.3.28 - 2.0.1. I don't think anything prior to that will work with it, due to the lack of typemaps before then.

Please see Alien for an explanation of the Alien namespace.

CONSTRUCTOR

new()

my $swig = Alien::SWIG->new();

Create a new Alien::SWIG object for querying the installed configuration.

ARGUMENTS: None.

RETURNS: blessed $object, or undef on failure.

METHODS

path()

my $path = $swig->path();

Get the base install path of the SWIG installation.

ARGUMENTS: None.

RETURNS: Directory $name, with no trailing path separator.

version()

my $version = $swig->version();

Get the version of the copy of SWIG that was installed.

(Not to be confused with Alien::SWIG $VERSION, which is this Perl wrapper's version number.)

ARGUMENTS: None.

RETURNS: The SWIG $version as a string, e.g. '2.0.1'.

executable()

my $executable = $swig->executable();

Get the location of the swig executable program, that was compiled during the installation of this module.

ARGUMENTS: None.

RETURNS: Absolute path to swig, ready for executing.

includes()

# As string
my $includes = $swig->includes();

# As list
my @includes = $swig->includes();

Get the SWIG -I include directives needed to run SWIG against the installed version. swig has the base path compiled into it, but if for any reason the path doesn't work, you can use this to manually specify the -I directives.

ARGUMENTS: None.

RETURNS: Depending on context, returns a $scalar containing all the paths joined with spaces, as -I/path, or an @array containing all the paths, as -I/path, one-per-element.

module_dir()

my $module_dir = $swig->module_dir();

Get the base directory of the installed SWIG modules. This can be used to set the SWIG_LIB environment variable, as detailed in the SWIG docs.

ARGUMENTS: None.

RETURNS: Absolute $path to modules base directory.

cmd_line()

my $cmd_line = $swig->cmd_line();

Get a full, working command line, with all the -I directives included, that you can use to run the installed copy of SWIG.

ARGUMENTS: None.

RETURNS: $string containing a runnable command, with all -I directives appended.

EXPORTS

use Alien::SWIG qw( path version executable module_dir includes );

This module OPTIONALLY exports the following subs:

SEE ALSO

http://www.swig.org/ - SWIG, the Simplified Wrapper and Interface Generator

http://www.swig.org/Doc2.0/Contents.html - The SWIG Documentation

The bin/ directory of this module's distribution

AUTHORS

Jason McManus, <infidel at cpan.org>

ACKNOWLEDGEMENTS

Many of the build scripts in this module were modelled on Alien::IE7.

BUGS

Please report any bugs or feature requests to bug-alien-swig at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Alien-SWIG. The authors will be notified, and then you'll automatically be notified of progress on your bug as changes are made.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Alien::SWIG

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright (c) 2011 Jason McManus

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.