xmltv/grab Memoize.pm,1.15,1.16
Stefan Becker <[email protected]>
| Newsgroups | gmane.comp.tv.xmltv.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/xmltv/xmltv/grab
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv22649/grab
Modified Files:
Memoize.pm
Log Message:
Fix caching for latest Perl/Memoize
There seems to be a regression in latest Perl and/or Memoize which breaks
tied variables when used together with LIST_CACHE => 'MERGED'. As a result
XMLTV --cache stops to store any data inbetween runs into the cache file.
As a work around we replace the 'MERGE' with 'FAULT', i.e. we no longer
allow accessing memoized functions in list context. A quick browse through
the XMLTV source code revealed that no user of XMLTV::Memoize uses it to
memoize functions that return non-scalars.
NOTE: if grabbers should start to fail after this change then please use
the line information provided by the abort message and change
... foobar(...) ...
to
... scalar( foobar(...) ) ...
Index: Memoize.pm
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/Memoize.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Memoize.pm 11 Jan 2006 18:01:38 -0000 1.15
--- Memoize.pm 21 Jun 2014 16:30:14 -0000 1.16
***************
*** 75,80 ****
require Memoize;
require DB_File;
! my @tie_args = ('DB_File', $filename,
! POSIX::O_RDWR() | POSIX::O_CREAT(), 0666);
# $from_caller is a sub which converts a function name into one
--- 75,81 ----
require Memoize;
require DB_File;
! # Annoyingly tie(%cache, @tie_args) doesn't work
! #my @tie_args = ('DB_File', $filename,
! # POSIX::O_RDWR() | POSIX::O_CREAT(), 0666);
# $from_caller is a sub which converts a function name into one
***************
*** 99,103 ****
my $r = Memoize::memoize($from_caller->($_),
SCALAR_CACHE => [ HASH => \%cache ],
! LIST_CACHE => 'MERGE');
die "could not memoize $_" if not $r;
push @r, $r;
--- 100,112 ----
my $r = Memoize::memoize($from_caller->($_),
SCALAR_CACHE => [ HASH => \%cache ],
! #
! # There seems to be a regression in latest Perl
! # or Memoize that causes 'MERGE' to break tied
! # variables. As no user of this module calls
! # memoized functions in list context, we can
! # simply replace it with 'FAULT'.
! #
! #LIST_CACHE => 'MERGE');
! LIST_CACHE => 'FAULT');
die "could not memoize $_" if not $r;
push @r, $r;
------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems