28 |
write_file $path, $default; |
write_file $path, $default; |
29 |
warn "default $path = $default"; |
warn "default $path = $default"; |
30 |
$value = $default; |
$value = $default; |
31 |
} else { |
} elsif ( -e $path ) { |
32 |
$value = read_file $path if -e $path; |
if ( -l $path ) { |
33 |
|
$value = readlink $path; |
34 |
|
$value =~ s{.*/([^/]+)$}{$1}; |
35 |
|
} else { |
36 |
|
$value = read_file $path; |
37 |
|
} |
38 |
} |
} |
39 |
return $value; |
return $value; |
40 |
} |
} |
41 |
|
|
42 |
|
sub mac { |
43 |
|
my $ip = shift; |
44 |
|
my $mac = client::conf( $ip, 'mac' ); |
45 |
|
$mac =~ s{(..)}{$1:}g; |
46 |
|
$mac =~ s{:$}{}; |
47 |
|
$mac = qq|<tt>$mac</tt>| if (caller(1))[3] =~ m{^httpd}; |
48 |
|
return uc($mac); |
49 |
|
} |
50 |
|
|
51 |
1; |
1; |