{ # the values of the following hash are subs defined elsewhere my %dispatch = ( dev_random => \&_dev_random, dev_urandom => \&_dev_urandom, random_org => \&_random_org, hotbits => \&_hotbits, ); sub _seed { my $none = $_[ 0 ] eq 'none'; my @methods = @_ if not $none; @seed = (); my $magic_num = magic_num(); while ( @methods ) { my $method = shift @methods; my $need = $magic_num - @seed; if ( @methods && looks_like_number( $methods[0] ) ) { my $n = shift @methods; $need = $n if $n < $need; } unless ( defined $dispatch{ $method } ) { push @errors, "Unsupported seeding method: $method"; next; } push @seed, $dispatch{ $method }->( $need ); last if @seed >= $magic_num; } push @errors, 'Full seed not acquired from sources: ' . @seed if @seed < $magic_num and not $none; push @seed, time, $$; $#seed = $magic_num - 1 if @seed > $magic_num; # Seed the PRNG seed( @seed ); } } #### elsif ($sym =~ 'auto') { # To auto-seed or not $auto_seed = $sym =~ /no|!/; } #### elsif ($sym =~ /^(no|!)?auto$) { $auto_seed = not defined $1; } #### elsif ($sym eq 'auto') { # To auto-seed or not $auto_seed = 1; # default value for $auto_seed should be 0 } #### { no strict 'refs'; *{"${pkg}::$sym"} = \&$sym; } #### eval { require LWP::UserAgent; }; if ($@) { push(@errors, "Failure loading LWP::UserAgent: $@"); next; } #### eval { require LWP::UserAgent } or do { push @errors, "Failure loading LWP::UserAgent: $@"; next; };