fix perl 5.8.8 compat

This commit is contained in:
Matthew Connelly 2015-03-01 21:27:40 +00:00
parent 78aa8b0bfa
commit 79f3acfc8e
1 changed files with 8 additions and 7 deletions

View File

@ -10,11 +10,17 @@ use vars '$VERSION'; $VERSION = '1.1.0'; #Version nu
use 5.008_008;
use Data::Validate::IP qw(is_public_ipv4 is_public_ipv6); #for validating v4/v6 addresses
use Getopt::Long qw(:config posix_default bundling pass_through); #for intelligently handling cli arguments
use Data::Validate::IP qw/is_public_ipv4 is_public_ipv6/; #for validating v4/v6 addresses
use Getopt::Long qw/:config posix_default bundling pass_through/; #for intelligently handling cli arguments
use Net::DNS; #for doing forward and reverse lookups
use Net::IP; #for converting IPs to their reverse zones
use File::Copy qw/copy/;
use Net::DNS::ZoneFile;
use Net::DNS::ZoneParse qw/writezone/;
use POSIX qw/strftime/;
use Regexp::Common;
#conf
my $def_rdns = 'hosted-by.mycompany.com'; #Recomend default is "hosted-by.your-website.tld".
my $def_dns = '8.8.8.8'; #Recommended default is 8.8.8.8 or 4.2.2.1.
@ -70,7 +76,6 @@ Configuration:
exit;
}
sub validate_domain {
require Regexp::Common;
my $domain = shift;
return 1 if $domain =~ /^$RE{net}{domain}\.?$/;
return 0;
@ -120,7 +125,6 @@ sub does_zone_exist {
return 1;
}
sub get_zone_array {
require Net::DNS::ZoneFile;
#returns 1 on record exists, 0 on record doesn't exist, -1 on zone exists but isn't writeable, -2 on file exists but isn't a zone, -3 on file doesn't exist
my $ip = shift;
my ($rec,$zone) = get_arpa $ip;
@ -141,15 +145,12 @@ sub does_record_exist {
return 0;
}
sub generate_soa_serial {
require POSIX qw(strftime);
my $cur_serial = shift;
my $yyyymmdd = strftime "%Y%m%d", localtime;
return $cur_serial+1 if $cur_serial =~ /^$yyyymmdd[0-9]{2}$/;
return $yyyymmdd."00";
}
sub write_zone {
require File::Copy qw(copy);
require Net::DNS::ZoneParse qw(writezone);
my $zone = shift;
my @z = @_;
foreach(@z) {$_->serial(generate_soa_serial $_->serial) if $_->type eq "SOA";} #update SOA