From 2eeaf2830b8ec5df9a50488d58993275f9ef1387 Mon Sep 17 00:00:00 2001 From: Steven Schubiger Date: Tue, 19 Nov 2013 21:45:57 +0100 Subject: Optimize retrieving session identifier --- client.pl | 3 +-- server.cgi | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/client.pl b/client.pl index 729663f..cbf9b58 100755 --- a/client.pl +++ b/client.pl @@ -94,8 +94,7 @@ my $save_session = sub my $get_session = sub { open(my $fh, '<', $session_file) or _die "Cannot open $session_file for reading: $!\nPerhaps try running --init\n"; - my $session = do { local $/; <$fh> }; - chomp $session; + chomp(my $session = <$fh>); close($fh); return $session; diff --git a/server.cgi b/server.cgi index c2df36b..1adcf09 100755 --- a/server.cgi +++ b/server.cgi @@ -88,8 +88,7 @@ if ($params{init}) { } else { open(my $fh, '<', $session_file) or die "Cannot open $session_file for reading: $!\nPerhaps try running --init\n"; - my $session = do { local $/; <$fh> }; - chomp $session; + chomp(my $session = <$fh>); close($fh); die "Session ID mismatch\n" unless $params{session} eq $session; -- cgit v1.2.3