package Iurt::File; use base qw(Exporter); use Iurt::Config qw(get_mandatory_arch); use File::Copy 'move'; use File::Path 'make_path'; use Iurt::Util qw(plog); use MDK::Common qw(cat_ find member partition); use strict; our @EXPORT = qw( create_file check_file_timeout read_line ); sub create_file { my $file = shift; my @contents = @_; open my $FILE, ">$file" or die "FATAL: can't open $file for writing"; print $FILE "@contents"; } sub check_file_timeout { my ($file, $time) = @_; my $i = 0; while ($i < $time && (!-f $file || -z $file)) { sleep 1; $i++ } $i == $time; } sub read_line { my $file = shift; open my $FILE, "<$file" or die "FATAL: can't open $file for reading"; my $contents = <$FILE>; $contents; }