As in between "perl Build.PL" and "Build test"?

I assume there's not a sub ACTION_ to override!

Or maybe there's a better way to do what I need to do?

Here's what I need to do: I'm writing an Alien:: module that needs to
check the Windows registry to see if the software I'm trying to
installed is already installed.  I have a configure_requires on
Win32API::Registry 0.30 for the systems that support configure_requires,
but for those that don't, I want to delay checking for my software until
after prerequisites are checked and Win32API::Registry installed.

(Of course, the first thing I do after all the use statements is "die
'OS unsupported' if ('MSWin32' ne $OSNAME);" so that's not a worry.)

1) Can I do it late in my Build PL (i.e. after or during
"$builder->create_build_script();") [which I assume is what I'm supposed
to do if I can] 
or do I have to override the "Build" stage somehow?

2) Based on that answer, what do I override?

Here's what the check looks like so far:

require Win32API::Registry;
Win32API::Registry->import(qw(0.30 :ALL));

my $WIX_REGISTRY_KEY = 'SOFTWARE\Microsoft\Windows Installer XML\3.0';
my $NET20_REGISTRY_KEY = 'SOFTWARE\Microsoft\NET Framework
Setup\NDP\v2.0.50727';
my $WIX_URL = 'http://wix.sourceforge.net/releases/3.0.5106.0/Wix3.msi';
my $NET20_URL =
'http://download.microsoft.com/download/0/8/c/08c19fa4-4c4f-4ffb-9d6c-150906578c9e/NetFx20SP1_x86.exe';

my ($default, $answer, $installed, $key, $type, $data);

$installed = 0;
if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, $NET20_REGISTRY_KEY, 0, KEY_READ,
$key ))
{
        if (RegQueryValueEx( $key, 'Installed', [], $type, $data, [] )) {
                if ($data > 0) {
                        $installed = 1;
                }
        }
}

$default = 'y';
$answer = 0;

unless ($installed) {
        $answer = $builder->y_n('Install .NET Framework 2.0 SP1?', $default);

        if ($answer) {
                my $not_ok = system "msiexec /i $NET20_URL /qb!";
                if ($not_ok) {
                        die q{Couldn't install .NET Framework 2.0 SP1, stopped};
                }
        } else {
                die q{Didn't install .NET Framework 2.0 SP1, stopped};
        }
}
        
$installed = 0;
$default = 'y';
$answer = 0;

if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, $WIX30_REGISTRY_KEY, 0, KEY_READ,
$key ))
{
        if (RegQueryValueEx( $key, 'ProductVersion', [], $type, $data, [] )) {
                if ($data =~ m/3.0.(\d+).0/) {
                        $version = $1;
                        if ($version >= 5106) {
                                $installed = 1;
                        } else {
                                $default = 'n';
                        }
                }
        }
}

unless ($installed) {
        $answer = $builder->y_n('Install Windows Installer XML version 
3.0.5106?', $default);

        if ($answer) {
                my $not_ok = system "msiexec /i $WIX_URL /qb!";
                if ($not_ok) {
                        die q{Couldn't install WiX, stopped};
                }
        } else {
                die q{Didn't install WiX, stopped};
        }
}

--
Curtis Jewell
[email protected]

%DCL-E-MEM-BAD, bad memory
-VMS-F-PDGERS, pudding between the ears

[I use PC-Alpine, which deliberately does not display colors and
pictures in HTML mail]
--
Curtis Jewell
[email protected]

%DCL-E-MEM-BAD, bad memory
-VMS-F-PDGERS, pudding between the ears

[I use PC-Alpine, which deliberately does not display colors and pictures in 
HTML mail]

Reply via email to