Dear Monks,

I have a Perl/Tk script that uses POE::Component::EasyDBI to spawn a child process to make an sql query on a database (postgresql using DBD::Pg). This script works well on Sun Solaris 10 and Mac OS 10.4.9. However it crashes Activestate Perl when the script starts POE.

I have a feeling that there is a conflict when Tk and POE are used together in Activestate Perl. Below is an example code that crashes. "use Tk" line is sufficient to crash Activestate perl's interpreter - even without creating a toplevel window.

This issue did not occur under Sun Solaris 10 native perl compiler and the native Mac OS 10.4.9 perl compiler.

The error message that I get from Windows is attached below after the code.

I'm not sure if this is a bug in the Activestate Perl's compiler or a bug somewhere in my simple script below. Please can someone advice?

Thank you.
Yee Ling

#!/usr/local/bin/perl use strict; use Data::Dumper; use Tk; use POE qw( Component::EasyDBI); sub POE::Kernel::ASSERT_DEFAULT () { 1 } sub POE::Kernel::TRACE_DEFAULT () { 1 } sub POE::Kernel::TRACE_SESSIONS () { 1 } my $dbtype="dbi:Pg:database=cnc"; my $usr="cnc"; my $pass="cnc_diner"; &mainpoe; sub mainpoe { POE::Component::EasyDBI->spawn( alias => 'EasyDBI', dsn => "$dbtype", username => "$usr", password => "$pass", ); POE::Session->create( inline_states => { _start => \&startme, result_handler => \&resulthandler, }, options => { trace => 1, debug => 1 }, ); sub startme { $_[KERNEL]->post( 'EasyDBI', arrayhash => { sql=>"select id from testtable", event => 'result_handler', } ); } sub resulthandler { my ($resultref) = $_[ARG0]; print Dumper($resultref),"\n"; $_[KERNEL]->post( 'EasyDBI' => 'shutdown' ); } $poe_kernel->run(); }
Error message: AppName: perl.exe AppVer: 5.8.7.815 ModName: perl58.dll ModVer: 5.8.7.815 Offset: 00089af4

In reply to Perl/Tk with POE::Component::EasyDBI by Anonymous Monk

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.