Front page | perl.perl5.porters |
Postings from October 2008
[perl #60232] method cache not updated when dynamic subclass loaded through Storable::thaw
From:
laurent dami
Date:
October 30, 2008 08:24
Subject:
[perl #60232] method cache not updated when dynamic subclass loaded through Storable::thaw
Message ID:
rt-3.6.HEAD-11699-1225379842-527.60232-75-0@perl.org
# New Ticket Created by laurent dami
# Please include the string: [perl #60232]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60232 >
This is a bug report for perl from dami@cpan.org,
generated with the help of perlbug 1.36 running under perl 5.10.0.
-----------------------------------------------------------------
When Storable::thaw detects a class that is not already loaded,
it calls "require" to try to load it. If the class is not in a file,
but dynamically generated, we can put a coderef in @INC to
catch the load attempt, and generate the class on the fly.
This scheme worked fine in DBIx::DataModel on Perl<=5.8.8,
but no longer works on Perl5.10.0 (cf bug RT#40159).
Apparently when a class is dynamically created in response
to Storable::thaw, the method cache is not updated, and then
Storable fails to find the hook STORABLE_thaw.
I tried to insert a call to mro::invalidate_all_method_caches(),
but that doesn't solve the problem.
Attached is a code snippet that illustrates the problem.
Execution on Perl5.8.8
======================
d:\dami\Perl\Tst\Storable>perl dyn_subclass.pl store frozen
perl dyn_subclass.pl store frozen
class Foo::Bar dynamically created
d:\dami\Perl\Tst\Storable>perl dyn_subclass.pl retrieve frozen
perl dyn_subclass.pl retrieve frozen
class Foo::Bar dynamically created
hello, world
Execution on Perl5.10.0
=======================
d:\dami\Perl\Tst\Storable>perl dyn_subclass.pl store frozen
perl dyn_subclass.pl store frozen
class Foo::Bar dynamically created
d:\dami\Perl\Tst\Storable>perl dyn_subclass.pl retrieve frozen
perl dyn_subclass.pl retrieve frozen
class Foo::Bar dynamically created
No STORABLE_thaw defined for objects of class Foo::Bar (even after a "require Foo::Bar;") at ..\..\lib\Storable.pm (autosplit into ..\..\lib\auto\Storable\_retrieve.al) line 380, at dyn_subclass.pl line 81
-----------------------------------------------------------------
---
Flags:
category=library
severity=medium
---
Site configuration information for perl 5.10.0:
Configured by SYSTEM at Tue May 13 16:52:25 2008.
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
Platform:
osname=MSWin32, osvers=5.00, archname=MSWin32-x86-multi-thread
uname=''
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -DHASATTRIBUTE -fno-strict-aliasing -mms-bitfields',
optimize='-O2',
cppflags='-DWIN32'
ccversion='', gccversion='3.4.2 (mingw-special)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='g++', ldflags ='-L"D:\Perl\lib\CORE"'
libpth=\lib
libs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lmsvcrt
perllibs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lmsvcrt
libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl510.lib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-mdll -L"D:\Perl\lib\CORE"'
Locally applied patches:
ACTIVEPERL_LOCAL_PATCHES_ENTRY
33741 avoids segfaults invoking S_raise_signal() (on Linux)
33763 Win32 process ids can have more than 16 bits
32809 Load 'loadable object' with non-default file extension
32728 64-bit fix for Time::Local
---
@INC for perl 5.10.0:
d:/Perl/site/lib
d:/Perl/lib
.
---
Environment for perl 5.10.0:
HOME=D:\dami
LANG=fr
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=C:\Program Files\Fichiers communs\GTK\2.0\bin;d:\Perl\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\system32\nls;C:\WINDOWS\system32\nls\FRANCAIS;c:\Program Files\Novell\ZENworks\;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\Novell\ZENworks\;D:\ProgFiles\MinGW\bin;D:\ProgFiles\MSys\1.0\bin;C:\BASISclient\cs\bin;C:\BASISclient\www\bin;C:\Program Files\Novell\SecureLogin;D:\ProgFiles\GTK\2.0\bin;d:\ProgFiles\TortoiseSVN\bin;D:\Progfiles\Subversion\bin;D:\ProgFiles\Berkeley_DB_4.6.21\bin;D:\ProgFiles\Berkeley_DB_4.6.21\bin\debug;Z:.;
PERL_BADLANG (unset)
SHELL=D:/ProgFiles/emacs-22.2/bin/cmdproxy.exe
-
[perl #60232] method cache not updated when dynamic subclass loaded through Storable::thaw
by laurent dami