/[pxelator]/lib/PXElator/server.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/PXElator/server.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 408 by dpavlin, Wed Sep 9 10:13:08 2009 UTC revision 410 by dpavlin, Wed Sep 9 10:48:59 2009 UTC
# Line 5  use strict; Line 5  use strict;
5    
6  our $base_dir = '/srv/pxelator';  our $base_dir = '/srv/pxelator';
7    
8  tie our $ip,      'server::tie', 'server_ip' => '172.16.10.1';  use ties;
9  tie our $netmask, 'server::tie', 'natmask'   => '255.255.255.0';  
10  tie our $bcast,   'server::tie', 'bcast'     => '172.16.10.254';  tie our $ip,      'ties', 'server_ip' => '172.16.10.1';
11  tie our $ip_from, 'server::tie', 'ip_from'   => 10;  tie our $netmask, 'ties', 'natmask'   => '255.255.255.0';
12  tie our $ip_to,   'server::tie', 'ip_to'     => 100;  tie our $bcast,   'ties', 'bcast'     => '172.16.10.254';
13  tie our $domain,  'server::tie', 'domain'    => 'pxelator.lan';  tie our $ip_from, 'ties', 'ip_from'   => 10;
14  tie our $new_clients, 'server::tie', 'new_clients' => $ip_to - $ip_from;  tie our $ip_to,   'ties', 'ip_to'     => 100;
15    tie our $domain,  'ties', 'domain'    => 'pxelator.lan';
16    tie our $new_clients, 'ties', 'new_clients' => $ip_to - $ip_from;
17    
18  warn "DEV $ip $bcast $netmask";  warn "DEV $ip $bcast $netmask";
19    
# Line 56  sub debug { shared('debug', @_) || 0 } Line 58  sub debug { shared('debug', @_) || 0 }
58    
59  warn "loaded";  warn "loaded";
60    
61    1;
 package server::tie;  
   
 use File::Slurp;  
 use Data::Dump qw/dump/;  
   
 use server;  
   
 sub TIESCALAR {  
         warn dump @_;  
         my ($class,$name,$default) = @_;  
   
         my $path = $server::base_dir . '/conf/' . $name;  
   
         my $o = {  
                 path => $path,  
         };  
         write_file $o->{path}, $default unless -f $o->{path};  
   
 warn "TIESCALAR $name ", $o->{path}, " [$default]";  
   
         bless \$o,$class;  
 }  
   
 sub STORE {  
         warn dump @_;  
         my ( $self, $value ) = @_;  
         write_file $$self->{path}, $value;  
 }  
   
 sub FETCH {  
         warn dump @_;  
         my $self = shift;  
         my $v = read_file $$self->{path};  
         chomp($v);  
         $v;  
 }  
   
 3;  

Legend:
Removed from v.408  
changed lines
  Added in v.410

  ViewVC Help
Powered by ViewVC 1.1.26