diff options
author | Matteo Pasotti <matteo.pasotti@gmail.com> | 2014-09-20 16:38:12 +0200 |
---|---|---|
committer | Matteo Pasotti <matteo.pasotti@gmail.com> | 2014-09-20 16:38:12 +0200 |
commit | e1fe8ea0cb369036246522e7bf9401466b0c8174 (patch) | |
tree | faf4f9c0f73f585afb0e30b85a4feaaf4f162c63 /lib/AdminPanel/Shared.pm | |
parent | 845f609f1ed8a7941c2da60313baa8756454c775 (diff) | |
parent | 1c7b9933d1191049e49232194070f01882561a1f (diff) | |
download | manatools-e1fe8ea0cb369036246522e7bf9401466b0c8174.tar manatools-e1fe8ea0cb369036246522e7bf9401466b0c8174.tar.gz manatools-e1fe8ea0cb369036246522e7bf9401466b0c8174.tar.bz2 manatools-e1fe8ea0cb369036246522e7bf9401466b0c8174.tar.xz manatools-e1fe8ea0cb369036246522e7bf9401466b0c8174.zip |
Merge branch 'master' of ssh://git.mageia.org/software/adminpanel
Diffstat (limited to 'lib/AdminPanel/Shared.pm')
-rw-r--r-- | lib/AdminPanel/Shared.pm | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/lib/AdminPanel/Shared.pm b/lib/AdminPanel/Shared.pm index 3165bf04..b6c8fe15 100644 --- a/lib/AdminPanel/Shared.pm +++ b/lib/AdminPanel/Shared.pm @@ -112,7 +112,8 @@ $filename the name of the file to read =head3 OUTPUT -$content the content of the selected text file inside +depending from the context it returns the content +of the file as an array or a string =head3 DESCRIPTION @@ -123,28 +124,16 @@ if it fails #============================================================= -#sub apcat { -# my $fn = shift(); -# my $fh = undef; -# my @content = (); -# open($fh, "<", $fn) || return 0; -# while(<$fh>) -# { -# push(@content,$_); -# } -# return \@content; -#} - sub apcat { my $fn = shift(); my $fh = undef; - my $content = undef; + my @content = (); open($fh, "<", $fn) || return 0; while(<$fh>) { - $content .= $_; + push(@content, $_); } - return $content; + return (wantarray() ? @content : join('',@content)); } |