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

Annotation of trango/Net-Telnet-Trango/Build.PL, Revision 1.5

1.1       andrew      1: use strict;
                      2: use warnings;
                      3: use Module::Build;
1.3       andrew      4: use File::Spec;
1.5     ! andrew      5: # $RedRiver: Build.PL,v 1.4 2007/02/05 21:36:42 andrew Exp $
1.2       andrew      6:
1.4       andrew      7: my $cfg_file = File::Spec->catfile('t', 'tests.cfg');
1.1       andrew      8:
                      9: my $builder = Module::Build->new(
                     10:     module_name         => 'Net::Telnet::Trango',
                     11:     license             => 'perl',
                     12:     dist_author         => 'Andrew Fresh <andrew@cpan.org>',
                     13:     dist_version_from   => 'lib/Net/Telnet/Trango.pm',
                     14:     build_requires => {
                     15:         'Test::More' => 0,
                     16:     },
1.2       andrew     17:     add_to_cleanup      => [ 'Net-Telnet-Trango-*', $cfg_file ],
1.4       andrew     18:     create_makefile_pl  => 'traditional',
                     19:     create_readme       => 1,
                     20:     create_html         => 1,
                     21:     dynamic_config      => 1,
                     22:     auto_features       => {
                     23:         YAML_support =>
                     24:         {
                     25:             description => "Use YAML.pm to write META.yml files",
                     26:             requires => { YAML => ' >= 0.35, != 0.49_01 ' },
                     27:         },
                     28:         manpage_support =>
                     29:         {
                     30:             description => "Create Unix man pages",
                     31:             requires => { 'Pod::Man' => 0 },
                     32:         },
                     33:         HTML_support =>
                     34:         {
                     35:             description => "Create HTML documentation",
                     36:             requires => { 'Pod::Html' => 0 },
                     37:         },
                     38:     },
1.1       andrew     39: );
                     40:
1.5     ! andrew     41: get_config();
1.3       andrew     42:
1.5     ! andrew     43: $builder->create_build_script();
        !            44:
        !            45: sub get_config {
        !            46:     my %cfg;
        !            47:     print <<EOB;
        !            48:
        !            49: Net::Telnet::Trango needs some additional information and setup to
        !            50: perform it\'s full suite of tests.
        !            51:
        !            52: These tests MAY change settings on the units it connects to, so please
        !            53: do not use equipment that is in production.
        !            54:
        !            55: To skip these tests, hit "return".
        !            56:
        !            57: EOB
        !            58:
        !            59:     get_ap_config(\%cfg);
        !            60:
        !            61:     get_sudb_config(\%cfg) if $cfg{AP} && $cfg{AP_PASSWD};
        !            62:
        !            63:     get_su_config(\%cfg);
        !            64:
        !            65:     if (%cfg && open T,">$cfg_file") {
        !            66:         while (my ($key, $value) = each %cfg) {
        !            67:             print T $key, "\t", $value,"\n";
        !            68:         }
        !            69:         close T;
1.3       andrew     70:     }
1.5     ! andrew     71:
1.3       andrew     72: }
1.2       andrew     73:
1.5     ! andrew     74: sub get_ap_config {
        !            75:     my $cfg = shift;
        !            76:
        !            77:     print 'To run the AP tests, we need an IP and a password for an AP.', "\n";
        !            78:
        !            79:     $cfg->{AP}        = $builder->prompt("AP IP: ", $cfg->{AP}) || return;
        !            80:     $cfg->{AP_PASSWD} = $builder->prompt("AP Password:", $cfg->{AP_PASSWD})
        !            81:       || return;
        !            82: }
1.2       andrew     83:
1.5     ! andrew     84: sub get_sudb_config {
1.3       andrew     85:     my $cfg = shift;
                     86:
1.5     ! andrew     87:     print <<EOL;
        !            88: To run the SUDB tests, we need an suid and mac address of an
        !            89: SU that can reliably link to the AP.
        !            90: EOL
1.2       andrew     91:
1.5     ! andrew     92:     $cfg->{SU_ID}  = $builder->prompt("SU ID: ", $cfg->{SU_ID})  || return;
        !            93:     $cfg->{SU_MAC} = $builder->prompt("SU MAC:", $cfg->{SU_MAC}) || return;
        !            94: }
1.2       andrew     95:
1.5     ! andrew     96: sub get_su_config {
        !            97:     my $cfg = shift;
1.2       andrew     98:
1.5     ! andrew     99:     print 'To run the SU tests, we need an IP and a password of an SU.', "\n";
1.2       andrew    100:
1.5     ! andrew    101:     $cfg->{SU}        = $builder->prompt("SU IP: ", $cfg->{SU}) || return;
        !           102:     $cfg->{SU_PASSWD} = $builder->prompt("SU Password:", $cfg->{SU_PASSWD})
        !           103:       || return;
1.2       andrew    104: }
1.5     ! andrew    105:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>