read symlink destination istead of content
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 6 Aug 2009 18:43:55 +0000 (18:43 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 6 Aug 2009 18:43:55 +0000 (18:43 +0000)
lib/PXElator/client.pm

index 9000639..1c062f5 100644 (file)
@@ -28,8 +28,13 @@ sub conf {
                write_file $path, $default;
                warn "default $path = $default";
                $value = $default;
-       } else {
-               $value = read_file $path if -e $path;
+       } elsif ( -e $path ) {
+               if ( -l $path ) {
+                       $value = readlink $path;
+                       $value =~ s{.*/([^/]+)$}{$1};
+               } else {
+                       $value = read_file $path;
+               }
        }
        return $value;
 }