stuart: devel/kolab/Kolab Util.pm,1.4,1.5
cvs at intevation.de
cvs at intevation.de
Thu May 13 14:05:46 CEST 2004
Author: stuart
Update of /kolabrepository/devel/kolab/Kolab
In directory doto:/tmp/cvs-serv11879/Kolab
Modified Files:
Util.pm
Log Message:
The daemon/conf scripts should be able to run now, using the new template system.
Index: Util.pm
===================================================================
RCS file: /kolabrepository/devel/kolab/Kolab/Util.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Util.pm 12 May 2004 09:20:06 -0000 1.4
+++ Util.pm 13 May 2004 12:05:44 -0000 1.5
@@ -70,12 +70,20 @@
{
my $file = shift;
my $ref = shift;
+ my $fail = shift;
my %hash;
%hash = %$ref if ref($ref) eq 'HASH';
- return %hash if !$file;
- my $fd;
- return %hash if !($fd = IO::File->new($file, 'r'));
+ if (!$file) {
+ return undef if $fail;
+ return %hash;
+ }
+
+ my $fd = IO::File->new($file, 'r');
+ if (!$fd) {
+ return undef if $fail;
+ return %hash;
+ }
my $key;
while (<$fd>) {
@@ -93,12 +101,20 @@
{
my $file = shift;
my $ref = shift;
+ my $fail = shift;
my @array;
@array = @$ref if ref($ref) eq 'ARRAY';
- return @array if !$file;
- my $fd;
- return @array if !($fd = IO::File->new($file, 'r'));
+ if (!$file) {
+ return undef if $fail;
+ return @array;
+ }
+
+ my $fd = IO::File->new($file, 'r');
+ if (!$fd) {
+ return undef if $fail;
+ return @array;
+ }
my $value;
while (<$fd>) {
More information about the commits
mailing list