/[pxelator]/lib/PXElator/client.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/client.pm

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

revision 455 by dpavlin, Sat Jan 2 15:47:39 2010 UTC revision 541 by dpavlin, Sat Oct 9 12:28:01 2010 UTC
# Line 50  sub conf { Line 50  sub conf {
50          }          }
51    
52          my $path = ip_path $ip;          my $path = ip_path $ip;
53          mkdir $path unless -d $path;          mkdir $path unless -e $path;
54            warn "WARNING: $path not directory" unless -d $path;
55          $path .= '/' . $name;          $path .= '/' . $name;
56    
57          if ( defined $value ) {          if ( defined $value ) {
# Line 62  sub conf { Line 63  sub conf {
63                  write_file $path, $default;                  write_file $path, $default;
64                  warn "default $path = $default";                  warn "default $path = $default";
65                  $value = $default;                  $value = $default;
66            } elsif ( -l $path ) {
67                    $value = readlink $path;
68          } elsif ( -f $path ) {          } elsif ( -f $path ) {
69                  $value = read_file $path;                  $value = read_file $path;
70                  chomp $value;                  chomp $value;
# Line 78  sub all_conf { Line 81  sub all_conf {
81          foreach my $file ( glob("$path/*"), glob("$path/*/*") ) {          foreach my $file ( glob("$path/*"), glob("$path/*/*") ) {
82                  my $name = $file;                  my $name = $file;
83                  $name =~ s{^$path/+}{} || die "can't remove $path from $name";                  $name =~ s{^$path/+}{} || die "can't remove $path from $name";
84                  $conf->{ $name } = read_file $file if -f $file;                  next if -d $file;
85                    $conf->{ $name } =
86                            -l $file ? readlink  $file :
87                            -f $file ? read_file $file :
88                            '?';
89          }          }
90          return $conf;          return $conf;
91  }  }

Legend:
Removed from v.455  
changed lines
  Added in v.541

  ViewVC Help
Powered by ViewVC 1.1.26