Update: This problem has a similar solution to another problem posted, and the solution can be found here.

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

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.