+use Data::Dump qw(dump);
+use YAML qw();
+
+our $base_dir = '/srv/pxelator';
+
+use ties;
+
+tie our $ip, 'ties', 'server_ip' => '172.16.10.1';
+tie our $netmask, 'ties', 'netmask' => '255.255.255.0';
+tie our $bcast, 'ties', 'bcast' => '172.16.10.254';
+tie our $ip_from, 'ties', 'ip_from' => 10;
+tie our $ip_to, 'ties', 'ip_to' => 100;
+tie our $domain, 'ties', 'domain' => 'pxelator.lan';
+tie our $new_clients, 'ties', 'new_clients' => $ip_to - $ip_from;
+
+if ( my $dev = $ENV{DEV} ) {
+ my $ifconfig = `ifconfig $dev`;
+ die "can't ifconfig $dev" unless $ifconfig;
+ die "device $dev not up: ifconfig $dev\n$ifconfig" unless $ifconfig =~ m/UP/;
+ $ip = $1 if $ifconfig =~ m/inet addr:(\S+)/s;
+ $netmask = $1 if $ifconfig =~ m/Mask:(\S+)/s;
+ $bcast = $1 if $ifconfig =~ m/Bcast:(\S)/s;
+}
+
+warn "DEV $ip $bcast $netmask";
+
+our $conf = "$base_dir/conf";
+mkdir $conf unless -e $conf;
+
+sub conf {
+ warn "## conf $conf";
+ $conf;
+}
+
+use Module::Refresh qw//;
+sub refresh {
+ Module::Refresh->refresh;
+ my $from = (caller(1))[3];
+ $from =~ s{^(\w+)::.+$}{$1};
+ my $eval = '$' . $from . '::debug = server::debug();';
+ warn "refresh $eval\n";
+ eval $eval;
+ warn $@ if $@;
+};