8 more tests for Storage.t for tar and untar.
Reindented untar according to WGBP. Changed getFileContentsAsScalar to slurp the whole file at once.
This commit is contained in:
parent
8b7bafe1ae
commit
e48cce07fb
2 changed files with 40 additions and 12 deletions
|
|
@ -518,9 +518,8 @@ sub getFileContentsAsScalar {
|
|||
my $filename = shift;
|
||||
my $content;
|
||||
open (my $FILE,"<",$self->getPath($filename));
|
||||
while (<$FILE>) {
|
||||
$content .= $_;
|
||||
}
|
||||
local undef $/;
|
||||
$content = <$FILE>;
|
||||
close($FILE);
|
||||
return $content;
|
||||
}
|
||||
|
|
@ -820,13 +819,13 @@ Pass in a storage location object to extract the contents to, instead of having
|
|||
=cut
|
||||
|
||||
sub untar {
|
||||
my $self = shift;
|
||||
my $filename = shift;
|
||||
my $temp = shift || WebGUI::Storage->createTemp($self->session);
|
||||
chdir $temp->getPath;
|
||||
Archive::Tar->extract_archive($self->getPath($filename),1);
|
||||
$self->_addError(Archive::Tar->error) if (Archive::Tar->error);
|
||||
return $temp;
|
||||
my $self = shift;
|
||||
my $filename = shift;
|
||||
my $temp = shift || WebGUI::Storage->createTemp($self->session);
|
||||
chdir $temp->getPath;
|
||||
Archive::Tar->extract_archive($self->getPath($filename),1);
|
||||
$self->_addError(Archive::Tar->error) if (Archive::Tar->error);
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue