Re: Need some help...

2009-06-16 Thread Rob Fugina
On Tue, Jun 16, 2009 at 10:19, Phil Whelanphil...@gmail.com wrote:
 Hi Doug,

 It looks to me that the OBJECT constant is from POE is being interfered with
 by the OBJECT constant from Params::Validate.  After removing the validate
 method, the code seems to run OK.

 I think you need one of these...

    use POE::Session;

 I usually find the POE constants are not imported unless I use this.

To all -- First, thank you for the assistance.  It is greatly appreciated.

Second, the problem really did turn out to be Params::Validate's
exported symbols interfering with POE's (or POE::Session's) exported
symbols.  My solution was to be selective about what is exported from
Params::Validate (I had been using :types, now I export specific
symbols as needed), and *not* to export OBJECT, instead using
Params::Validate::OBJECT.

Thanks again,
Rob


Need some help...

2009-06-13 Thread Rob Fugina
I've been away from the list for a while, but now I'm wondering if
everyone else hasn't, as well.  Is anybody still here?

I've been having some trouble writing a couple of modules with object
states recently -- usually I stick to inline states -- and I was
hoping someone here would be able to give me some advice.  Maybe
someone can start by explaining why in the attached program it seems
that the parameters aren't lined up properly with the constants
(OBJECT, SESSION, HEAP, etc...).  The result is a mess...

Thanks,
Rob


objtest.pl
Description: Perl program


Re: Need some help...

2009-06-13 Thread Rob Fugina
A nasty error no doubt due to my rapid attempt at whipping up an
example program.  I've checked my original code suffering from the
problem, and it doesn't suffer from the same problem.

In my other code, I'm still having problems finding the object
reference in the _start handler (or any other, but one thing at a
time...).  Here's the code for _start.

sub _start
{
my ($kernel, $self, $heap) = @_[KERNEL, OBJECT, HEAP];
$kernel-alias_set($heap-{alias}) if defined $heap-{alias};
print Dumper('in _start', $self, $heap);
$kernel-alias_set($self-address);
}

It's failing on the last line, because $self is undef.  The dump in
the line before it, however, shows the object showing up in HEAP's
position, otherwise structured and blessed as it should be.  I also
dump the session object from the main program right after it's
created, and it also looks fine.  Not that I'm familiar with POE
internals, but in particular, the dispatch table shows _start listed
with a reference to the object and its _start method, right where they
were in the sample program previously sent.

Here's the Session creation in case it's useful for verifying
anything...  Not much there yet.

POE::Session-create(
object_states = [
$self = [ qw( _start ) ],
],
heap = {
alias = $params{Alias},
description = $params{Description} || uc($params{Address}),
},
);

If you need to see more code and you're willing to help me further,
I'd be more than happy to share.  Thank you for your quick attention
so far!

Rob


Re: Need some help...

2009-06-13 Thread Rob Fugina
I'm attaching my actual module, minus the path (for your convenience),
and a test script that demonstrates the error.  It doesn't suffer from
the original array slice problem.  I've done this before (object
states, that is), but they were fragile even then -- or they are now,
anyway.  I'm sure there's something simple or stupid I'm missing...

Rob


objtest2.pl
Description: Perl program


Controller.pm
Description: Perl program