aboutsummaryrefslogtreecommitdiffstats
path: root/lib/AdminPanel
diff options
context:
space:
mode:
authormatteo <matteo.pasotti@gmail.com>2014-09-20 17:35:05 +0300
committermatteo <matteo.pasotti@gmail.com>2014-09-20 17:35:05 +0300
commit1c7b9933d1191049e49232194070f01882561a1f (patch)
tree4c9147909b2f354d0d62d6e0ea7e2f1a9501684b /lib/AdminPanel
parent8014cc65f035bfdd3d98d942fe589b45b5ae0365 (diff)
downloadcolin-keep-1c7b9933d1191049e49232194070f01882561a1f.tar
colin-keep-1c7b9933d1191049e49232194070f01882561a1f.tar.gz
colin-keep-1c7b9933d1191049e49232194070f01882561a1f.tar.bz2
colin-keep-1c7b9933d1191049e49232194070f01882561a1f.tar.xz
colin-keep-1c7b9933d1191049e49232194070f01882561a1f.zip
fixed sub apcat (return conditioned by the context); drop some comment
Diffstat (limited to 'lib/AdminPanel')
-rw-r--r--lib/AdminPanel/Shared.pm21
1 files changed, 5 insertions, 16 deletions
diff --git a/lib/AdminPanel/Shared.pm b/lib/AdminPanel/Shared.pm
index 3165bf0..b6c8fe1 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));
}