Whoops, forgot to cc the list. David
---------- Forwarded message ---------- From: David Davis <[EMAIL PROTECTED]> Date: Feb 23, 2007 11:00 AM Subject: Re: POE and XUL To: Rutger Vos <[EMAIL PROTECTED]> The problem with the xul poco is that you can't send data back to the browser unless an action warrants it. You click a button, it hits the server and the data is sent back. I hit this same wall when I wrote poco xul. What you really need is cometd. http://cometd.com/ I'm the lead dev on the project and I will have the perl / poe server working soon. Perhaps this weekend. I want to integrate cometd with XUL too, so I'll let you know when I have something. Until then, feel free to join the mailing list for cometd, located on the site. Cheers! David On 2/23/07, Rutger Vos <[EMAIL PROTECTED]> wrote:
Dear POE programmers, I am attempting to write a POE program that does two things: 1. construct and manage a POE::Component::XUL application; 2. follow a growing log file. The idea is that the log file follower sends new lines in the log to the XUL application, to be displayed in a TextWindow XUL widget. As far as the XUL app is concerned - I got that figured out: it shows up in the browser window, and the buttons (etc.) do what I mean for them to do. Likewise, the log follower does what it's supposed to do, at least in so far as writing changes to the log to STDOUT. What doesn't seem to work is for those same changes to show up in the textwindow. Now, although I am a reasonable programmer, I must admit to a bit of voodoo programming in regards to POE - I'm reading the wiki, and trying to get my head around things, but it's a lot to take in. I assume things going wrong in my efforts have got something to do with the XUL app and the log follower doing their thing in their own space, but the reference to the textwindow that I pushed onto the HEAP when constructing the XUL app has the same memory address (refaddr) as the one that the log follower pulls off the heap when executing the log following callbacks, and still it's not working. I hope you don't mind me posting some code, to clarify: ####################################################### # snipped preambles... POE::Session->create( 'inline_states' => { '_start' => sub { my ( $kernel, $heap, $session ) = @_[KERNEL, HEAP, SESSION]; # build XUL app POE::Component::XUL->spawn( { 'port' => $PORT, # from @ARGV 'root' => $ROOT, # from @ARGV 'apps' => { 'Regman' => sub { # Regman = Registry Manager # widget construction happens here XUL::Node::Application::Regman->VERBOSE( $VERBOSE ); my $regman = XUL::Node::Application::Regman->_new; # push logwindow onto heap $heap->{'_logwindow'} = $regman->{'_logwindow'}; # return main window, this works, shows in firefox return $regman->_main; } }, } ); # the following is a blatant c&p from the wiki $_[HEAP]->{'wheel'} = POE::Wheel::FollowTail->new( 'Filename' => $LOGFILE, # from @ARGV 'InputEvent' => 'got_line', 'ErrorEvent' => 'got_error', 'SeekBack' => 1024, ); $_[HEAP]->{'first'} = 0; }, 'got_line' => sub { # this is the same logwindow as when the xul app was constructed my $logwindow = $_[HEAP]->{'_logwindow'}; if ( $_[HEAP]->{'first'}++ && defined $logwindow ) { # these messages show up when the log changes print "MESSAGE FROM LOGWATCHER: " . $_[ARG0] . "\n"; # attempt to send msg to xul widget $logwindow->value( $_[ARG0] ); # sure enough, the widget is modified, but not in firefox? # i.e. ->value() has changed, but the actual text widget # shows nothing? print "LISTENING TO LOGWINDOW: " . $logwindow->value() . "\n"; } elsif ( $_[HEAP]->{'first'}++ && ! defined $logwindow ) { print "MESSAGE FROM LOGWATCHER: " . $_[ARG0] . "\n"; } }, 'got_error' => sub { my $logwindow = $_[HEAP]->{'_logwindow'}; if ( $_[HEAP]->{'first'}++ && defined $logwindow ) { my $current = $logwindow->value; $logwindow->value( $current . "\n" . $_[ARG0] ); print "MESSAGE FROM LOGWATCHER: " . $_[ARG0] . "\n"; } elsif ( $_[HEAP]->{'first'}++ && ! defined $logwindow ) { print "MESSAGE FROM LOGWATCHER: " . $_[ARG0] . "\n"; } }, }, ); ####################################################### Any hints as to what might be going on? Thanks, Rutger