#!/usr/bin/perl use strict; use warnings; use Martnet::DDNS; use Regexp::Common qw/net/; use Getopt::Long qw/GetOptions/; use JSON::PP qw/encode_json true false/; sub usage { die "Usage: add-foreign \n"; } my $host = shift || die "No zonename provided\n"; my $ddns = Martnet::DDNS->new(); die "Zonename must end in a dot\n" unless ($host =~ /^[a-zA-Z0-9\.\-\_]+\.$/); my $payload = { }; my $txt = encode_json($payload); if ($edit) { $ddns->set($host, $txt, '_foreign'); } else { $ddns->add($host, $txt, '_foreign'); } exit 0;