Subject: | POE callbacks are blessed coderefs |
$session->callback() returns a blessed coderef. This means the checks
in PoCo::XUL->spawn for ref() eq 'CODE' fail. This patch uses
Scalar::Util::reftype(). Included as a prereq as well.
Subject: | Philip_Gwyn-PoCo-XUL-reftype.01.patch |
diff -rub POE-Component-XUL-0.02/lib/POE/Component/XUL.pm POE-Component-XUL-0.02.PG/lib/POE/Component/XUL.pm
--- POE-Component-XUL-0.02/lib/POE/Component/XUL.pm 2005-02-28 12:41:41.000000000 -0500
+++ POE-Component-XUL-0.02.PG/lib/POE/Component/XUL.pm 2007-02-27 08:53:59.000000000 -0500
@@ -4,6 +4,7 @@
use XUL::Node::Server;
use POE qw(Session XUL::SessionManager XUL::Session);
use Carp qw(croak);
+use Scalar::Util qw(reftype);
our $VERSION = '0.02';
@@ -15,14 +16,14 @@
$args->{apps} = {} if (!defined $args->{apps});
$args->{opts} = {} if (!defined $args->{opts});
- unless (ref($args->{apps}) eq 'HASH') {
+ unless (reftype($args->{apps}) eq 'HASH') {
croak "apps parameter must be a hash ref";
}
- unless (ref($args->{opts}) eq 'HASH') {
+ unless (reftype($args->{opts}) eq 'HASH') {
croak "opts parameter must be a hash ref";
}
foreach (keys %{$args->{apps}}) {
- if (ref($args->{apps}->{$_}) ne 'CODE') {
+ if (reftype($args->{apps}->{$_}) ne 'CODE') {
croak "apps parameter $_ must be a code reference (callback or sub)";
}
}
@@ -54,7 +55,7 @@
sub session_timeout {
my ($kernel, $heap, $sn) = (@_[KERNEL, HEAP], $_[ARG1]->[0]);
- if (defined($heap->{session_timeout}) && ref($heap->{session_timeout}) eq 'CODE') {
+ if (defined($heap->{session_timeout}) && reftype($heap->{session_timeout}) eq 'CODE') {
#no strict 'refs';
$heap->{session_timeout}->(splice(@_,ARG0));
#use strict 'refs';
diff -rub POE-Component-XUL-0.02/Makefile.PL POE-Component-XUL-0.02.PG/Makefile.PL
--- POE-Component-XUL-0.02/Makefile.PL 2004-09-28 18:31:44.000000000 -0400
+++ POE-Component-XUL-0.02.PG/Makefile.PL 2007-02-27 08:57:11.000000000 -0500
@@ -11,5 +11,6 @@
Digest::MD5 => undef,
Aspect => undef,
Time::HiRes => undef,
+ Scalar::Util => undef
},
);