develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r34936 - trunk/lib/Parrot

From:
jkeenan
Date:
January 4, 2009 12:48
Subject:
[svn:parrot] r34936 - trunk/lib/Parrot
Message ID:
20090104204847.45606CB9F9@x12.develooper.com
Author: jkeenan
Date: Sun Jan  4 12:48:46 2009
New Revision: 34936

Modified:
   trunk/lib/Parrot/Distribution.pm

Log:
Restore slurp() method.

Modified: trunk/lib/Parrot/Distribution.pm
==============================================================================
--- trunk/lib/Parrot/Distribution.pm	(original)
+++ trunk/lib/Parrot/Distribution.pm	Sun Jan  4 12:48:46 2009
@@ -34,6 +34,8 @@
 
 use ExtUtils::Manifest;
 use File::Spec;
+use lib qw( lib );
+use Parrot::BuildUtil ();
 
 use base 'Parrot::Docs::Directory';
 
@@ -782,6 +784,23 @@
     };
 }
 
+sub slurp {
+    my $self = shift;
+    my $path = shift;
+    my $buf;
+
+    # slurp in the file
+    open( my $fh, '<', $path )
+        or die "Cannot open '$path' for reading: $!\n";
+    {
+        local $/;
+        $buf = <$fh>;
+    }
+    close $fh;
+
+    return $buf;
+}
+
 1;
 
 # Local Variables:



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About