Changeset 2334


Ignore:
Timestamp:
01/30/20 22:55:33 (4 years ago)
Author:
nanardon
Message:

Use directly URI::_punycode::encode_punycode()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Task/Buildnet.pm

    r2333 r2334  
    1313use Net::IPv4Addr; 
    1414use Net::IPv6Addr; 
    15 use URI; 
     15use URI::_punycode qw(encode_punycode decode_punycode); 
    1616 
    1717=head1 NAME 
     
    513513                $dbzone .= sprintf( 
    514514                    "%-30s IN    %-4s     %s\n", 
    515                     URI->new("http://$res")->host, 
     515                    encode_punycode($res), 
    516516                    ($ip =~ /:/ ? 'AAAA' : 'A'), 
    517517                    $ip 
     
    522522                    $dbzone .= sprintf( 
    523523                        "%-30s IN    %-4s     %s\n", 
    524                         URI->new("http://$_")->host, 
     524                        encode_punycode($_), 
    525525                        ($ip =~ /:/ ? 'AAAA' : 'A'), 
    526526                        $ip 
     
    540540                    $dbzone .= "; $msg\n"; 
    541541                } else { 
    542                     $dbzone .= sprintf("%-30s IN    CNAME    %s\n", URI->new("http://$_")->host, URI->new("http://$res")->host,); 
     542                    $dbzone .= sprintf("%-30s IN    CNAME    %s\n", encode_punycode($_), encode_punycode($res)); 
    543543                } 
    544544            } 
     
    548548                    $dbzone .= sprintf( 
    549549                        "%-30s IN    SSHFP    %s\n", 
    550                         URI->new("http://$name")->host, 
     550                        encode_punycode($name), 
    551551                        $sshfp, 
    552552                    ); 
     
    563563 
    564564    my $domain = $ozone->get_attributes('domain') || ''; 
    565     my $punyDomain = URI->new("http://$domain")->host; 
     565    my $punyDomain = encode_punycode($domain); 
    566566    my $dbzone = ''; 
    567567    if ($ozone->get_attributes('net')) { 
     
    633633            $dbzone .= sprintf($fmt, $revip, 
    634634                $reverse =~ /\.$/ 
    635                     ? (URI->new("http://$reverse")->host, ($punyDomain ? "$punyDomain." : '.')) 
    636                     : (URI->new("http://$reverse")->host, '.')); 
     635                    ? (encode_punycode($reverse), ($punyDomain ? "$punyDomain." : '.')) 
     636                    : (encode_punycode($reverse), '.')); 
    637637        } 
    638638    } 
Note: See TracChangeset for help on using the changeset viewer.