From e82e5cf6c4e3b8d56bebab98ead3c441ea84b124 Mon Sep 17 00:00:00 2001 From: etienne Date: Fri, 7 Mar 2003 16:14:07 +0000 Subject: hack pour pouvoir charger en parallele plusieurs modules qui surchargent Tk::Zinc::InitObject --- Perl/Zinc/Debug.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Perl') diff --git a/Perl/Zinc/Debug.pm b/Perl/Zinc/Debug.pm index bc3dcfc..e346f48 100644 --- a/Perl/Zinc/Debug.pm +++ b/Perl/Zinc/Debug.pm @@ -52,12 +52,14 @@ my %instances; my @instances; my %cmdoptions; my $initobjectfunction; + sub BEGIN { # test if ZincDebug is loaded using the -M perl option $preload = 1 if (caller(2))[2] == 0; return unless $preload; # parse ZincDebug options require Getopt::Long; + #Getopt::Long::Configure('pass_through'); Getopt::Long::GetOptions(\%cmdoptions, 'itemModBtn=s', 'tkey=s', 'optionsToDisplay=s', 'optionsFormat=s', 'color=s', 'enclosedModBtn=s', 'overlapModBtn=s', 'searchKey=s', @@ -65,17 +67,18 @@ sub BEGIN { ); # save current Tk::Zinc::InitObject function; it will be invoked in # overloaded one (see below) - $initobjectfunction = \&Tk::Zinc::InitObject; + $initobjectfunction = Tk::Zinc->can('InitObject'); + *Tk::Zinc::InitObject = *InitObject; } # Hack to capture the instance of zinc. ZincDebug functions are invoked here. # Note that created bindings might be overloaded by the application. -sub Tk::Zinc::InitObject { +sub InitObject { Tk::Widget::InitObject(@_); + #print "Tk::Zinc::InitObject\n"; # invoke function possibly overloaded in other modules - &$initobjectfunction; - #print "***** ZincDebug Tk::Zinc::InitObject zinc=$_[0]\n"; + &$initobjectfunction(@_) if $initobjectfunction; return unless $preload; my $zinc = $_[0]; my @options = (); -- cgit v1.1