Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Win32::OLE objects

by jimbojones (Friar)
on May 06, 2005 at 19:28 UTC ( #454789=note: print w/replies, xml ) Need Help??

in reply to Win32::OLE objects


I ran your code and added the following:
sub LogInit{ my $appname = $_[0]; my $module = $_[1]; my $apploglevel = $_[2]; $LogObj = Win32::OLE->new('LOGGERHELPER.UILogHelp'); print "Ref is ", ref $LogObj, "\n"; print Win32::OLE->LastError(), "\n" unless ($LogObj); $Log0bj->{LogLevel} = $apploglevel; $Log0bj->{AppName} = $appname; $Log0bj->{Module} = $module; Win32::MsgBox('my log is "'.$LogObj.'"'); return $LogObj;
the Reference is null, and the last error is:

Ref is Win32::OLE(0.1702) error 0x800401f3: "Invalid class string" Can't call method "LogMessage" on unblessed reference at + line 42.
Perhaps you need to import the LOGGERHELPER.UILogHelp constants in the Win32::OLE call?

- j

Replies are listed 'Best First'.
Re^2: Win32::OLE objects
by anselmomh (Initiate) on May 06, 2005 at 19:37 UTC
    When all the code is in the same perl file it all works its only when i moved the logging code to a module that passing hte Win32::OLE object seems to get upset
    perl file --> calls LogInit
    pm file --> creates Win32::OLE object and passes back
    perl file --> calls LogIT passing in the Win32::OLE object that it got back
    pm file --> uses that object to pass it ARGS which logs things
    so basically im not passing Win32::OLE object correctly i guess i just dont know how to fix it :(

      Right; is it possible that your 'use Win32::OLE' statement was/is different in your .pl file as opposed to the .pm file? Or had a use Win32::OLE::Const line?

      - j

        The Win32::OLE::Const line was never in the perl file and an older copy that works has the exact same lines for the creation of the object .. there must be something you have to do when passing a Win32::OLE object back and forth between a perl file and a module that im not aware of :(

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2018-03-17 11:08 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (223 votes). Check out past polls.