buildverification/smoketest/FileRead.pm
branchRCL_3
changeset 20 493058e57c8c
parent 0 9736f095102e
equal deleted inserted replaced
19:4ca382093dae 20:493058e57c8c
       
     1 # Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 # All rights reserved.
       
     3 # This component and the accompanying materials are made available
       
     4 # under the terms of "Eclipse Public License v1.0"
       
     5 # which accompanies this distribution, and is available
       
     6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 #
       
     8 # Initial Contributors:
       
     9 # Nokia Corporation - initial contribution.
       
    10 #
       
    11 # Contributors:
       
    12 #
       
    13 # Description:
       
    14 #
       
    15 
       
    16 #!/usr/bin/perl -w
       
    17 package FileRead;
       
    18 use strict;
       
    19 ##########################################################################
       
    20 #
       
    21 # Name    :  file_read()
       
    22 # Synopsis:  Reads in the contents of a file into an array
       
    23 # Inputs  :  Filename
       
    24 # Outputs :  array
       
    25 #
       
    26 ##########################################################################
       
    27 sub file_read
       
    28 {
       
    29     my ($filename) = @_;
       
    30 
       
    31     local($/) = undef;
       
    32     local(*FILE);
       
    33  
       
    34     open(FILE, "<$filename") || die "open $filename: $!";
       
    35     my @slurparr = <FILE>;
       
    36     close(FILE) || die "close $filename: $!";
       
    37 
       
    38     return $slurparr[0];
       
    39 }
       
    40 
       
    41 1;