Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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

Hi

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 CLUILogger.pm + line 42.
Perhaps you need to import the LOGGERHELPER.UILogHelp constants in the Win32::OLE call?

- j


Comment on Re: Win32::OLE objects
Select or Download Code
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 :(
      Hi

      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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://454789]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2014-09-22 06:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (182 votes), past polls