[PATCH] Fix incorrect population of programme data from in-memory cache

dinkypumpkin dinkypumpkin at gmail.com
Wed Feb 8 15:17:06 EST 2012


This patch has been incorporated into the get_iplayer Git repo.
Instructions for updating are here:

https://github.com/dinkypumpkin/get_iplayer/wiki/instructions

Commit message and patch follow:

When populating programme data from an in-memory cache, get_iplayer was
only copying PID strings rather than references to objects containing
full programme data.  Under some circumstances when running PVR searches,
this would lead to the fatal error:

Can't use string ("b123x45y") as a HASH ref while "strict refs" in use
---
 get_iplayer |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/get_iplayer b/get_iplayer
index c7322d4..6b21c5d 100755
--- a/get_iplayer
+++ b/get_iplayer
@@ -1518,8 +1518,8 @@ sub get_links {
 			$prog->{$pid} = progclass( lc($memcache->{$prog_type}->{$pid}->{type}) )->new( 'pid' => $pid );
 			# Deep-copy of elements in memcache prog instance to %prog
 			$prog->{$pid}->{$_} = $memcache->{$prog_type}->{$pid}->{$_} for @cache_format;
-			# Copy pid into index_prog hash
-			$index_prog->{ $prog->{$pid}->{index} } = $pid;
+			# Copy object reference into index_prog hash
+			$index_prog->{ $prog->{$pid}->{index} } = $prog->{$pid};
 		}
 		logger "INFO: Got (quick) ".(keys %{ $memcache->{$prog_type} })." memcache entries for $prog_type\n" if $opt->{verbose};
 		return 0;
-- 
1.7.8.3




More information about the get_iplayer mailing list