| File: | config/auto/ipv6.pm |
| Coverage: | 90.4% |
| line | stmt | bran | cond | sub | code |
|---|---|---|---|---|---|
| 1 | # Copyright (C) 2001-2007, Parrot Foundation. | ||||
| 2 | |||||
| 3 - 12 | =head1 NAME config/auto/ipv6.pm - determine ipv6 capabilities of local machine =head1 DESCRIPTION This configuration step probes the local machine to determine if it capable of running an ipv6 stack. =cut | ||||
| 13 | |||||
| 14 | package auto::ipv6; | ||||
| 15 | |||||
| 16 | 2 2 2 | use strict; | |||
| 17 | 2 2 2 | use warnings; | |||
| 18 | |||||
| 19 | 2 2 2 | use base qw(Parrot::Configure::Step); | |||
| 20 | |||||
| 21 | 2 2 2 | use Parrot::Configure::Utils ':auto'; | |||
| 22 | |||||
| 23 | |||||
| 24 | sub _init { | ||||
| 25 | 2 | my $self = shift; | |||
| 26 | 2 | my %data; | |||
| 27 | 2 | $data{description} = q{Determine IPV6 capabilities}; | |||
| 28 | 2 | $data{result} = q{}; | |||
| 29 | 2 | return \%data; | |||
| 30 | } | ||||
| 31 | |||||
| 32 | sub runstep { | ||||
| 33 | 2 | my ( $self, $conf ) = @_; | |||
| 34 | |||||
| 35 | 2 | my $ipv6_status = 0; | |||
| 36 | |||||
| 37 | 2 | $conf->cc_gen('config/auto/ipv6/test.in'); | |||
| 38 | 2 2 | eval { $conf->cc_build(); }; | |||
| 39 | 2 | if (!$@) { | |||
| 40 | 2 2 | my $output = eval { $conf->cc_run_capture() }; | |||
| 41 | 2 | if (!$@ && $output =~ /OK/) { | |||
| 42 | 2 | $ipv6_status = 1; | |||
| 43 | } | ||||
| 44 | else { | ||||
| 45 | 0 | $conf->debug("ipv6 not detected: <$@> <$output>"); | |||
| 46 | } | ||||
| 47 | } | ||||
| 48 | 2 | $conf->cc_clean(); | |||
| 49 | 2 | $self->_handle_ipv6_status($conf, $ipv6_status); | |||
| 50 | |||||
| 51 | 2 | return 1; | |||
| 52 | } | ||||
| 53 | |||||
| 54 | sub _handle_ipv6_status { | ||||
| 55 | 4 | my ($self, $conf, $ipv6_status) = @_; | |||
| 56 | 4 | $conf->data->set( HAS_IPV6 => 1) if $ipv6_status; | |||
| 57 | 4 | $ipv6_status | |||
| 58 | ? $self->set_result('yes') | ||||
| 59 | : $self->set_result('no'); | ||||
| 60 | } | ||||
| 61 | |||||
| 62 | 1; | ||||
| 63 | |||||
| 64 | # Local Variables: | ||||
| 65 | # mode: cperl | ||||
| 66 | # cperl-indent-level: 4 | ||||
| 67 | # fill-column: 100 | ||||
| 68 | # End: | ||||
| 69 | # vim: expandtab shiftwidth=4: | ||||