[BACK]Return to Build.PL CVS log [TXT][DIR] Up to [local] / trango / Net-Telnet-Trango

File: [local] / trango / Net-Telnet-Trango / Build.PL (download)

Revision 1.2, Mon Feb 5 19:21:02 2007 UTC (17 years, 3 months ago) by andrew
Branch: MAIN
Changes since 1.1: +30 -2 lines

add a stub for network testing, and prompt for the username and password when running Build.PL

use strict;
use warnings;
use Module::Build;
# $RedRiver: Build.PL,v 1.1 2007/02/05 18:10:55 andrew Exp $

my $cfg_file = File::Spec->catfile('t', 'do_network.tests');

my $builder = Module::Build->new(
    module_name         => 'Net::Telnet::Trango',
    license             => 'perl',
    dist_author         => 'Andrew Fresh <andrew@cpan.org>',
    dist_version_from   => 'lib/Net/Telnet/Trango.pm',
    build_requires => {
        'Test::More' => 0,
    },
    add_to_cleanup      => [ 'Net-Telnet-Trango-*', $cfg_file ],
);

get_config();

$builder->create_build_script();

sub get_config
{
    my %cfg;
    print <<EOB;

Net::Telnet::Trango needs to log into an AP to
perform it\'s full suite of tests. To log in, we
need a test AP, a login, a password.

To skip these tests, hit "return".

EOB

    $cfg{AP}       = $builder->prompt("AP: ", $cfg{AP}) || return;
    $cfg{PASSWD}   = $builder->prompt("Password:", $cfg{PASSWD}) || return;

    if (open T,">$cfg_file") {
        while (my ($key, $value) = each %cfg) {
            print T $key, "\t", $value,"\n";
        }
        close T;
    }
}