[Bps-public-commit] r16977 - Prophet/trunk/lib/Prophet

jesse at bestpractical.com jesse at bestpractical.com
Sat Nov 22 07:53:27 EST 2008


Author: jesse
Date: Sat Nov 22 07:53:27 2008
New Revision: 16977

Added:
   Prophet/trunk/lib/Prophet/Util.pm

Log:
oops! missing file

Added: Prophet/trunk/lib/Prophet/Util.pm
==============================================================================
--- (empty file)
+++ Prophet/trunk/lib/Prophet/Util.pm	Sat Nov 22 07:53:27 2008
@@ -0,0 +1,22 @@
+package Prophet::Util;
+use strict;
+use File::Basename;
+
+sub updir {
+    my $self = shift;
+    my $path = shift;
+    my ($file, $dir, undef) = fileparse(File::Spec->rel2abs($path));
+    return $dir;
+}
+
+sub slurp {
+    my $self = shift;
+    my $abspath = shift;
+    open (my $fh, "<", "$abspath") || die $!;
+
+    my @lines = <$fh>;
+    close $fh;
+    
+    return wantarray ? @lines : join('', at lines);
+}
+1;



More information about the Bps-public-commit mailing list