Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^3: RE (tilly) 1: Win32::OLE

by hopkinsj (Novice)
on Dec 15, 2004 at 04:11 UTC ( #414928=note: print w/replies, xml ) Need Help??

in reply to Re: Re: RE (tilly) 1: Win32::OLE
in thread Win32::OLE

Get rid of the perl interpreter on line1. I had the same problem. After that, my windows2000 system worked fine with the script.

Replies are listed 'Best First'.
Re^4: RE (tilly) 1: Win32::OLE
by ff (Hermit) on Feb 23, 2005 at 17:18 UTC
    Have you just killed the messenger? That is, perhaps deleting #! perl -w just turns off warning messages? At least that's what I find on MY w2k system. (And I'm still in the dark about Constant subroutine emptyenum redefined at C:/Perl/site/lib/Win32/OLE/ line -1, <DATA> line 183 )
      He has indeed just killed the messenger.

      As for being in the dark about that message, I already told you what it means. It means that emptyenum was defined twice (probably in different modules and then exported to the same one). If the two values are the same, then the error is harmless. If the values are different, you have a real problem. (It probably is harmless.)

      I'd personally start tracking the error down by looking at C:/Perl/site/lib/Win32/OLE/

        Gosh, thanks for noticing that this ancient thread was burbling again. :-)

        Update: I reposted this note in its own thread and received a solution at Re: 'emptyenum' error w/ use Win32::OLE::Const 'Microsoft Word'

        To recap: I'm getting a series of 15 messages like:

        Constant subroutine emptyenum redefined at C:/Perl/site/lib/Win32/OLE/ line -1.

        The warnings do seem to be harmless because my program is creating the Word documents that I want via templates. My problems are:
        1. I'd like to be positive these messages are harmless and won't cause me problems if I leave them alone.
        2. If harmless, I'd be okay with turning off warnings before/after Const invocation but the documentation about them seems to say that these errors are so important that they can't be muted. Of course I could temporarily send errors to /dev/null but that seems like asking for trouble later on.
        3. Is it possible to fix the problems that are causing the warnings?

        While you did say that emptyenum was being run more than once, that didn't do much for me because I couldn't see anywhere where it WAS being run. I couldn't find it in nor in my own code. However, I did pull out my handy-dandy OLE browser that comes with ActiveState's perl and noticed that

        # Type Library Browser for wdCharacterCaseHID shows emptyenum

        Now there's zillions of little pieces of stuff that is investigatable (?) about MS Word with that tool and it was mostly a shot in the dark that elicited that nugget. But not a total shot, as relevant lines from my code include:

        use Win32::Shortcut; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Word'; my $x = Win32::OLE->GetActiveObject('Word.Application'); # snip $x->Selection->Delete( { Unit=>wdCharacter, Count=>1 } ); # The above is my kiddy-scripted version of some VisualBasic that I # came upon: Selection.Delete Unit:=wdCharacter, Count:=1

        which is what made me check out the properties of wdCharacterCaseHID. Now, that nugget may be totally irrelevant whereupon I'm exhibiting my cluelessness about what to do.

        Some cluck commands that I embedded into also give some results that puzzle me. When the code above runs (the code is in a sub called '' in a package called 'ws'), cluck tells me:

        ws::BEGIN() called at C:/Perl/site/lib/Win32/OLE/ line 120

        Line 120 is the line in '' above that invokes

        However, when my main program gets around to invoking a different sub ('' from a different package 'email_out'), and that sub has lines including:

        use strict; use warnings; use Win32::OLE; use Win32::OLE::Const 'Microsoft Outlook';

        then cluck tells me:

        email_out::BEGIN() called at line 1027

        and in this case cluck's output seems to properly notify that the module was being invoked from line 1027 of (the line with the <Microsoft Outlook> string). The fact of no complaints from the Outlook stuff would seem to say that emptyenum is being used strangely within Word....

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://414928]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2017-09-21 21:32 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (253 votes). Check out past polls.