Hello everyone,

I have a perl code for monitoring news title.
I use Win32::OLE to access news server.
And news title is updated at real time.
I need keep login state to receive news title.
Login event is also implemented using Win32::OLE

I want execute another code during receiving news title at real time.
In the below example, I want to print something after &get_news.
But I couldn't see print message because my code is stuck at "Win32::OLE->MessageLoop" to receive event of news title update.

How can I execute another code during receiving news update real time?

The below code is brief version of my code, not full code.
==================================================
use Win32::OLE qw(EVENTS); &Login; &get_news; print "something printed during receiving news title at real time\n"; sub get_news { my $XAReal = Win32::OLE->new('XA_DataSet.XAReal'); $XAReal->SetFieldData('InBlock','nwcode','NWS001'); my $XARealEvents = sub { my ( $obj, $event, @args ) = @_; # 1: OnReceiveRealData if ($event) { my $time = $obj->GetFieldData('OutBlock', 'time'); my $title = $obj->GetFieldData('OutBlock', 'title'); print "[$time] $title\n"; } }; Win32::OLE->WithEvents( $XAReal, $XARealEvents, '{16602768-2C96-4D93-984B-E36E7E35BFBE}', ); $XAReal->AdviseRealData; Win32::OLE->MessageLoop; } sub Login { $XASession = Win32::OLE->new('XA_Session.XASession'); $XASessionEvents = sub { my ($obj, $event, @args) = @_; # 1: OnLogin # 2: OnLogout # 3: OnDisconnect if($event == 1) { print "Login success\n"; Win32::OLE->QuitMessageLoop; } else { die "\nLogin ERROR!\n"; } }; Win32::OLE->WithEvents( $XASession, $XASessionEvents, '{6D45238D-A5EB-4413-907A-9EA14D046FE5}', ); $XASession->Login($user, $pass); Win32::OLE->MessageLoop; }

In reply to another code execution during Win32::OLE->MessageLoop by dynastes

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.