Hi Monks-
Here is a strange problem. The perl application listed below works fine for me, with the supplied data under windows XP (32-bit) with activestate perl 5.8.7. However, if I build an executable using perlapp, and run it on the same data, windows reports that the program stops responding, and I can't scroll, nor will the stop button work).
In addition, using poe_main_window doesn't work (see where I commented "WHY DO I HAVE TO DO THIS?").
If I take the JSON stuff out, the scrolling & stop button work, and it seems to run ok.
Any thoughts or help is much appreciated!
Thanks
-Craig
Here is the perlapp command line:
perlapp --add "POE::Wheel" --add "POE::Loop::Select" --add "POE::Resou +rce::Aliases" --add "POE::Resource::Events" --add "POE::Resource::Ext +refs" --add "POE::Resource::FileHandles" --add "POE::Resource::SIDs" +--add "POE::Resource::Sessions" --add "POE::Resource::Signals" --add +"POE::Resource::Statistics" --verbose --clean --force --lib lib --exe + analyze.exe display.pl
Here is the data for the input file:
{"Text":["Hi there...","How are you?","1","2","3","4","5","6","7","8", +"9","10","11","12","13","14","15","16","17","18","19","20","21","22", +"23","24","24","26","27","28","29"]}
Here is the script:
use strict; use warnings; use Tk; # This MUST come before use POE... use POE; use POE::Component::Client::TCP; use POE::Filter::Stream; use POE::Wheel::FollowTail; use Data::Dumper; use JSON::XS; # Setup input file (if any)... my $infile = shift || die "Missing Input File..."; _displayData(); # Setup data processing... my $sess = _processData($infile); # This should simply create a dummy postback on the tail session my $subref = $sess->postback('DontDie'); # Go... print STDERR "STARTING to process data...\n"; POE::Kernel->run; exit; sub _processData{ my $ifile=shift || die "Missing input file"; POE::Session->create( inline_states=>{ _start=>sub { print "Session ", $_[SESSION]->ID, " has started.\n"; $_[KERNEL]->alias_set("myClient"); my ( $kernel, $heap ) = @_[ KERNEL, HEAP ]; $_[HEAP]->{wheel}=POE::Wheel::FollowTail->new( Seek=>0, Filename=>$ifile, InputEvent=>'display', ); }, display => sub{ InputEvent=>$_[KERNEL]->post(Display=>data=>$_[ARG0]), }, sendStop => sub{ print "Stopping file input\n"; my $heap = $_[HEAP]; delete $heap->{wheel}; }, }, ), } sub _displayData{ my $hwid = shift; my $text; my $json=new JSON::XS; $json=$json->ascii([1]); POE::Session->create( inline_states => { _start => sub { $_[KERNEL]->alias_set("Display"); my $kernel=$_[KERNEL]; # WHY DO I HAVE TO DO THIS???? my $top = $poe_main_window || MainWindow->new(); #my $top = $poe_main_window; # Create Stop button... $top->Button(-text=>"Stop", -command=>sub{ &stop($kernel); $top->update; } )->pack(-side=>'bottom'); # Create top level Tree... $text = $top->Scrolled('Text', -scrollbars=>'osow')-> pack(-fill=>'both', -side=>'left', -expand=>1); }, data=>sub{ my $input=$_[ARG0] || return; my $node=$json->decode($input); my $txt = join("\n", @{$node->{Text}}); $text->insert('end', $txt); $text->update; }, }); } sub stop{ my $ker = shift; if ($ker){ print STDERR "Sending sendStop to myClient\n"; $ker->call("myClient","sendStop"); } }
In reply to POE, pTk, JSON Cause Lockup with perlapp by cmv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |