[Chicago-talk] Testing a module installation
Steven Lembark
lembark at wrkhors.com
Sun Jan 25 23:16:35 PST 2009
> I've built a module, its on CPAN, Finance::InteractiveBrokers::TWS.
>
> I want to test that it installs properly from cpan and pulls down any
> required modules and works.
>
> I want to simulate a fresh install on a new host. How does one go
> about this? I have though maybe using a VM with a fresh OS install,
> but that seems like overkill, and I'm sure its unnecessary.
>
> What's the proper why to simulate a bare bones Perl installation?
Hack 'use' to only find things that you know are
in the core disto. Your F::IB::TWS::MinimalInstall
module would supply a copy of use that dies on or
ignores any use requests for non-core modules:
use Symbol qw( qualify_to_ref );
my %core_modz = ();
@core_modz{ qw( modules you want to exist ) } = ();
sub use
{
my $module = shift;
my $caller = caller;
exists $core_modz{ $_[0] }
or
{
warn "Unavailable module: $_[0];
return
};
eval "require $module";
if( my $sub = $module->can( import ) )
{
local $" = ",";
# push any side effects into the caller's space.
eval "package $caller; $sub->( $module, @_ )";
}
1
}
You can get a list from "perldoc perlmodlib". Check the
Perl Test Notebook for a complete example of overriding
language behavior (they hack the system call).
You are probably better off just including what you
need in the Makefile.PL.
--
Steven Lembark 85-09 90th St.
Workhorse Computing Woodhaven, NY, 11421
lembark at wrkhors.com +1 888 359 3508
More information about the Chicago-talk
mailing list