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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |