about summary refs log tree commit homepage
path: root/lib/PublicInbox/Config.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2017-02-10 21:27:11 +0000
committerEric Wong <e@80x24.org>2017-02-10 21:27:11 +0000
commit416ba2fdab4f6de20ad7ec3656a057bb01b17339 (patch)
tree440afa9375a95e9b2eaa89a44cfa917ddb7a1571 /lib/PublicInbox/Config.pm
parentad679cb6bedd72bb70df47dbedac5a8d785ecc2b (diff)
downloadpublic-inbox-416ba2fdab4f6de20ad7ec3656a057bb01b17339.tar.gz
This allows RepoConfig to be independent of the
PublicInbox::Inbox class.
Diffstat (limited to 'lib/PublicInbox/Config.pm')
-rw-r--r--lib/PublicInbox/Config.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index f6275cdd..f2c40b13 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -167,4 +167,14 @@ sub _fill {
         $self->{-by_name}->{$name} = $rv;
 }
 
+sub try_cat {
+        my ($path) = @_;
+        my $rv = '';
+        if (open(my $fh, '<', $path)) {
+                local $/;
+                $rv = <$fh>;
+        }
+        $rv;
+}
+
 1;