diff --git a/lib/WebGUI/Storage.pm b/lib/WebGUI/Storage.pm index c38dcb9a6..cf2b51947 100644 --- a/lib/WebGUI/Storage.pm +++ b/lib/WebGUI/Storage.pm @@ -619,7 +619,7 @@ sub getFileContentsAsScalar { my $filename = shift; my $content; open (my $FILE,"<",$self->getPath($filename)); - local undef $/; + local $/; $content = <$FILE>; close($FILE); return $content; diff --git a/t/Storage.t b/t/Storage.t index 152adeb77..a7041b7d9 100644 --- a/t/Storage.t +++ b/t/Storage.t @@ -26,7 +26,7 @@ my $session = WebGUI::Test->session; my ($extensionTests, $fileIconTests) = setupDataDrivenTests($session); -my $numTests = 81; # increment this value for each test you create +my $numTests = 82; # increment this value for each test you create plan tests => $numTests + scalar @{ $extensionTests } + scalar @{ $fileIconTests }; my $uploadDir = $session->config->get('uploadsPath'); @@ -65,7 +65,7 @@ is( $storage1->getLastError, undef, "No errors during path creation"); # #################################################### -is( $storage1->getPathFrag, 'fo/ob/foobar'); +is( $storage1->getPathFrag, 'fo/ob/foobar', 'pathFrag returns correct value'); #################################################### # @@ -171,7 +171,7 @@ open my $fcon, "< ".$filePath or die "Unable to open $filePath for reading: $!\n"; my $fileContents; { - local undef $/; + local $/; $fileContents = <$fcon>; } close $fcon; @@ -180,6 +180,8 @@ is ($fileContents, $content, 'file contents match'); is ($storage1->getFileContentsAsScalar($filename), $content, 'getFileContentsAsScalar matches'); +isnt($/, undef, 'getFileContentsAsScalar did not change $/'); + foreach my $extTest (@{ $extensionTests }) { is( $storage1->getFileExtension($extTest->{filename}), $extTest->{extension}, $extTest->{comment} ); }