Skip Menu |
 

This queue is for tickets about the Win32-GUI CPAN distribution.

Report information
The Basics
Id: 37665
Status: open
Priority: 0/
Queue: Win32-GUI

People
Owner: Nobody in particular
Requestors: perl-cpan [...] bereft.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 1.03
  • 1.06
Fixed in: (no value)



Subject: DateTime loaded before Win32::GUI -> VERSION mismatch
Download (untitled) / with headers
text/plain 1.1k
I've noticed I need to use Win32::GUI before DateTime, otherwise I get this error: e:\ddict>perl -MDateTime -MWin32::GUI -e 1 DateTime object version 1.06 does not match $DateTime::VERSION 0.43 at E:/Perl/site/lib/Win32/GUI.pm line 139. Compilation failed in require. BEGIN failed--compilation aborted. # this works e:\ddict>perl -MWin32::GUI -MDateTime -e 1 # Win32::GUI marked line 139 with >> sub bootstrap_subpackage { my($package) = @_; $package = 'Win32::GUI::' . $package; my $symbol = $package; $symbol =~ s/\W/_/g; no strict 'refs'; DynaLoader::dl_install_xsub( "${package}::bootstrap", DynaLoader::dl_find_symbol_anywhere( "boot_$symbol" ) ); Show quoted text
>> &{ "${package}::bootstrap" };
} I'd guess that the bootstrap code is looking in $DateTime::VERSION instead of $Win32::GUI::DateTime::VERSION Is that what is going on? If this is actually a DateTime bug then let me know. e:\ddict>perl -v This is perl, v5.8.8 built for MSWin32-x86-multi-thread (with 18 registered patches, see perl -V for more detail) Copyright 1987-2007, Larry Wall Binary build 822 [280952] provided by ActiveState http://www.ActiveState.com Built Jul 31 2007 19:34:48 Thanks
Download (untitled) / with headers
text/plain 136b
I confirm I see the same behaviour with Win32::GUI vs DateTime, on Strawberry Perl 5.10.0 on WinXP. I attach a unit test for the error.
#!perl use strict; use warnings; use Test::More tests => 3; # This test checks to see if we can load DateTime and then Win32::GUI # succesfully. use_ok 'DateTime'; require_ok 'Win32::GUI'; require_ok 'Win32::GUI::Constants';
Download (untitled) / with headers
text/plain 303b
See also bug reported here: https://sourceforge.net/tracker/index.php?func=detail&aid=2659788&group_id=16572&atid=116572 I attach a (only loosely tested) patch that seems to resolve the issue, although I'm not 100% sure why it was broken, so I don't have total trust. It passes the unit tests though..
commit 15f2369e9e34b1d42e4251deb98d7a9a342da6d7 Author: unknown <TobyC@.(none)> Date: Wed Mar 4 13:27:59 2009 +1100 Adjust bootstrapping of sub packages to try and resolve RT37665 diff --git a/GUI.pm b/GUI.pm index 58a78f9..5f81ef0 100644 --- a/GUI.pm +++ b/GUI.pm @@ -12,9 +12,7 @@ # ############################################################################### package Win32::GUI; - -require DynaLoader; # to dynuhlode the module. -@ISA = qw( DynaLoader ); +use base 'DynaLoader'; ############################################################################### # STATIC OBJECT PROPERTIES @@ -105,30 +103,30 @@ sub constant { # delegated to Win32::GUI::Constants. Use of this is deprecated, and will be # removed in the future -sub AUTOLOAD { - my $constant = $AUTOLOAD; - $constant =~ s/.*:://; - my ($callpkg, $file, $line) = caller; - require Win32::GUI::Constants; - my $val = Win32::GUI::Constants::constant($constant); - - if(defined $val) { - no warnings; # avoid perl 5.6 warning about prototype mismatches - eval "sub $AUTOLOAD() {$val}"; - use warnings; - warnings::warnif 'deprecated', - "Use of '$AUTOLOAD' is deprecated. Use 'Win32::GUI::Constants::$constant' instead."; - goto &$AUTOLOAD; - } - - #TODO - should we die? Many unknown methods may also end up here - can we find a better wording? - die "Can't find '$constant' in package ". __PACKAGE__ . - ". Used at $file line $line.\n"; -} +#sub AUTOLOAD { +# my $constant = $AUTOLOAD; +# $constant =~ s/.*:://; +# my ($callpkg, $file, $line) = caller; +# require Win32::GUI::Constants; +# my $val = Win32::GUI::Constants::constant($constant); +# +# if(defined $val) { +# no warnings; # avoid perl 5.6 warning about prototype mismatches +# eval "sub $AUTOLOAD() {$val}"; +# use warnings; +# warnings::warnif 'deprecated', +# "Use of '$AUTOLOAD' is deprecated. Use 'Win32::GUI::Constants::$constant' instead."; +# goto &$AUTOLOAD; +# } +# +# #TODO - should we die? Many unknown methods may also end up here - can we find a better wording? +# die "Can't find '$constant' in package ". __PACKAGE__ . +# ". Used at $file line $line.\n"; +#} +# sub bootstrap_subpackage { my($package) = @_; - $package = 'Win32::GUI::' . $package; my $symbol = $package; $symbol =~ s/\W/_/g; no strict 'refs'; @@ -2717,6 +2715,7 @@ sub DESTROY { # which contains the major version number of the shell32.dll library that # has been loaded. package Win32::GUI::NotifyIcon; + our $SHELLDLL_VERSION = (Win32::GUI::GetDllVersion('shell32'))[0]; ########################################################################### @@ -2978,6 +2977,7 @@ sub DESTROY { # Work with a Window's DC (Drawing Context) # package Win32::GUI::DC; +use base 'Win32::GUI'; ########################################################################### # (@)METHOD:new Win32::GUI::DC(WINDOW | DRIVER, DEVICE) @@ -3488,6 +3488,9 @@ sub DESTROY { ############################################################################### # dynamically load in the GUI.dll module. # +package Win32::GUI::MDI; +use base 'Win32::GUI'; + package Win32::GUI; @@ -3495,34 +3498,34 @@ package Win32::GUI; # Win32::GUI::GetDllVersion during use/compile time #bootstrap Win32::GUI; -bootstrap_subpackage 'Animation'; -bootstrap_subpackage 'Bitmap'; -bootstrap_subpackage 'Button'; -bootstrap_subpackage 'Combobox'; -bootstrap_subpackage 'DateTime'; -bootstrap_subpackage 'DC'; -bootstrap_subpackage 'Font'; -bootstrap_subpackage 'Header'; -bootstrap_subpackage 'ImageList'; -bootstrap_subpackage 'Label'; -bootstrap_subpackage 'Listbox'; -bootstrap_subpackage 'ListView'; -bootstrap_subpackage 'NotifyIcon'; -bootstrap_subpackage 'ProgressBar'; -bootstrap_subpackage 'Rebar'; -bootstrap_subpackage 'RichEdit'; -bootstrap_subpackage 'Splitter'; -bootstrap_subpackage 'TabStrip'; -bootstrap_subpackage 'Textfield'; -bootstrap_subpackage 'Toolbar'; -bootstrap_subpackage 'Tooltip'; -bootstrap_subpackage 'Trackbar'; -bootstrap_subpackage 'TreeView'; -bootstrap_subpackage 'StatusBar'; -bootstrap_subpackage 'UpDown'; -bootstrap_subpackage 'Window'; -bootstrap_subpackage 'MDI'; -bootstrap_subpackage 'MonthCal'; +bootstrap Win32::GUI::Animation; +bootstrap Win32::GUI::Bitmap; +bootstrap Win32::GUI::Button; +bootstrap Win32::GUI::Combobox; +bootstrap Win32::GUI::DateTime; +bootstrap Win32::GUI::DC; +bootstrap_subpackage 'Win32::GUI::Font'; +bootstrap Win32::GUI::Header; +bootstrap Win32::GUI::ImageList; +bootstrap Win32::GUI::Label; +bootstrap Win32::GUI::Listbox; +bootstrap Win32::GUI::ListView; +bootstrap_subpackage 'Win32::GUI::NotifyIcon'; +bootstrap Win32::GUI::ProgressBar; +bootstrap Win32::GUI::Rebar; +bootstrap_subpackage 'Win32::GUI::RichEdit'; +bootstrap Win32::GUI::Splitter; +bootstrap Win32::GUI::TabStrip; +bootstrap Win32::GUI::Textfield; +bootstrap Win32::GUI::Toolbar; +bootstrap Win32::GUI::Tooltip; +bootstrap Win32::GUI::Trackbar; +bootstrap Win32::GUI::TreeView; +bootstrap Win32::GUI::StatusBar; +bootstrap Win32::GUI::UpDown; +bootstrap Win32::GUI::Window; +bootstrap Win32::GUI::MDI; +bootstrap Win32::GUI::MonthCal; # Preloaded methods go here.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.