in reply to Re: Re: Win32 OLE painfully slow
in thread Win32 OLE painfully slow

Dunno what your problem is. This code:

use Win32::OLE; use Win32::OLE::Const; my $xl = Win32::OLE::Const->Load("Microsoft Excel"); foreach my $const (sort keys %$xl) { printf "$const = %s\n", $xl->{$const}; #printf "sub $const { %d }\n", $xl->{$const}; }

loads and prints all the constants in a couple of seconds. An ugly hack would be to hard code the constants. You could do this simply by using the code above to dump

sub constname { NNN }

Cut and paste the output into your code or your own constants module like Win32::OLE::Const::Excel. Leave the generator code there but comment it out. Net effect - you get the constants you need fast. If the constants change just rerun the generator and it will get updated. Not a perfect solution but quite a practical kludge.

cheers

tachyon

Replies are listed 'Best First'.
Re: Re: Re: Re: Win32 OLE painfully slow
by spurperl (Priest) on Apr 13, 2004 at 17:14 UTC
    It loads and prints all the constants in more than a minute for me (99% of it for loading).

    I'll try to dig into the suggestions other monks gave me (thanks !), but I must say that your kludge really does help, now everything works super fast. This only proves that the problem is in loading the constants.

    Thanks !