Inline::Select - Dynamic selection of ILSM for a package
use Inline::Select::Register ( PACKAGE => 'Calc', Inline => [ Perl => sub {require 't/Calc.pm'} ] ) ; use Inline::Select::Register ( PACKAGE => 'Calc', Inline => [ CPP => 't/Calc.cpp' ] ) ; use Inline::Select::Register ( PACKAGE => 'Calc', Inline => [ Java => 't/Calc.java' ] ) ; use Inline::Select::Register ( PACKAGE => 'Calc', Inline => [ Python => 't/Calc.py' ] ) ; use Inline::Select ( PACKAGE => 'Calc', Inline => $ARGV[0] # one of 'Perl', 'CPP', 'Java', 'Python' ) ; my $c = new Calc() ; ok($c->add(2, 3), 5) ;
Inline::Select provides an easy way to select between implementations of an API written in different programming languages. The original idea is to use your existing the Perl test suite to test the implementations in the other languages.
Inline::Select
Usage of Inline::Select is pretty simple. For each programming language, you must speficy a 'use Inline::Select::Register' (or Inline::Select->register() at runtime) statement to register the use of Inline for that language. All the Inline parameters are saved and that Inline block will only be evaluated if that language is selected later on.
Inline
When you are done registering Inline blocks, you then spefify a 'use Inline::Select' (or Inline::Select->bind() at runtime) to actually load (in the caller package) the Inline block for the selected language.
Inline::Select::Register
The PACKAGE option is used to associate the different 'use Inline::Select::Register' and 'use Inline::Select' declarations together.
PACKAGE
The Inline option is an ARRAY reference that contains the parameters that will be passed to 'use Inline' if that language is selected.
However, there is one exception to this rule. If the first element if the array matches /perl/i, the second element must be a CODE reference that will be used to load the Perl code.
The Inline option is SCALAR that specifies contains the selected language.
Patrick LeBoutillier, <patl@cpan.org>
Copyright 2005 by Patrick LeBoutillier
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Inline::Select, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Inline::Select
CPAN shell
perl -MCPAN -e shell install Inline::Select
For more information on module installation, please visit the detailed CPAN module installation guide.