From b4ef882e4cb11915f9f59557ae88dc8f0c0ab9d2 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 18 Feb 2008 18:17:12 +0000 Subject: [PATCH] Fix a bug where $/ ended up being undef globally. --- lib/WebGUI/Storage.pm | 2 +- t/Storage.t | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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..4d9b67046 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'); @@ -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} ); }