Need some help...
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...
Please turn on warnings. You are using my ($kernel, $self, $heap) = $_[KERNEL, OBJECT, HEAP]; when an array slice is needed my ($kernel, $self, $heap) = @_[KERNEL, OBJECT, HEAP]; Note the difference between 1) poerbook:~% perl -e 'my ($a, $b, $c) = $x[0,1,2];' (no output) and with warnings on: 1) poerbook:~% perl -we 'my ($a, $b, $c) = $x[0,1,2];' Multidimensional syntax $x[0,1,2] not supported at -e line 1. Name "main::x" used only once: possible typo at -e line 1. -- Rocco Caputo - rcap...@pobox.com On Jun 13, 2009, at 20:20, Rob Fugina wrote: 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
Re: Need some help...
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...
Sorry, works for me: % perl -Mstrict -MPOE -MData::Dumper -wle ' quote> my $self = bless { key => "value" }; quote> quote> POE::Session->create( quote> object_states => [ $self => ["_start"] ], quote> heap => { alias => "Alias" } quote> ); quote> quote> sub _start { quote> my ($k, $s, $h) = @_[KERNEL, OBJECT, HEAP]; quote> print Dumper("in _start", $s, $h); quote> } quote> quote> POE::Kernel->run()' $VAR1 = 'in _start'; $VAR2 = bless( { 'key' => 'value' }, 'main' ); $VAR3 = { 'alias' => 'Alias' }; -- Rocco Caputo - rcap...@pobox.com On Jun 13, 2009, at 21:20, Rob Fugina wrote: 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...
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
Re: POE site not displayed correctly under IE7
Sorry about that. It's important for the site to render nicely on many browsers, but I don't have the resources to make that happen. For example, testing IE is difficult on my PPC Powerbook. My CSS isn't very good either. I tweak attributes in Firebug until the page looks okay, then save the updates to a file. If you (or someone you know) can fix the CSS, I would be happy to install an update. I would be happy to credit them in the CSS file and changelog as well. Thank you. -- Rocco Caputo - rcap...@pobox.com On Jun 11, 2009, at 19:28, Jase Thew wrote: Tsz Ming WONG wrote: Hey, The problem has been around for more than a week. Refer to this screenshot: http://misc.xddnet.com/tmp/poe-ie7.jpg I am using IE7. Same issue with IE8. FF 3.0.10 and Chrome 2.0.172.31 render correctly however. Regards, Jase Thew.
Re: POE site not displayed correctly under IE7
Hi Rocco, You can change this in your global.css #navigation { FONT-SIZE: 8pt; WIDTH: 100px } to this... #navigation { float: left; FONT-SIZE: 8pt; WIDTH: 100px } Cheers, Phil On Sat, Jun 13, 2009 at 6:52 PM, Rocco Caputo wrote: > Sorry about that. It's important for the site to render nicely on many > browsers, but I don't have the resources to make that happen. For example, > testing IE is difficult on my PPC Powerbook. My CSS isn't very good either. > I tweak attributes in Firebug until the page looks okay, then save the > updates to a file. > > If you (or someone you know) can fix the CSS, I would be happy to install an > update. I would be happy to credit them in the CSS file and changelog as > well. > > Thank you. > > -- > Rocco Caputo - rcap...@pobox.com > > > On Jun 11, 2009, at 19:28, Jase Thew wrote: > >> Tsz Ming WONG wrote: >>> >>> Hey, >>> The problem has been around for more than a week. >>> Refer to this screenshot: http://misc.xddnet.com/tmp/poe-ie7.jpg >>> I am using IE7. >> >> Same issue with IE8. >> >> FF 3.0.10 and Chrome 2.0.172.31 render correctly however. >> >> Regards, >> >> Jase Thew. > > -- Mobile: +1 778-233-4935 Website: http://philw.co.uk Skype: philwhelan76 Twitter: philwhln Email : phil...@gmail.com iChat: philw...@mac.com
Re: Need some help...
Hi Rob, I think you have the POE::Sesssion->create syntax slightly wrong. This is from the docs POE::Session->create( object_states => [ $object_1 => { event_1a => "method_1a" }, $object_2 => { event_2a => "method_2a" }, ], inline_states => { event_3 => \&piece_of_code, }, ); You have >POE::Session->create( >object_states => [ >$self => [ qw( _start ) ], >], Which should be POE::Session->create( object_states => [ $self => [ qw( _start _start ) ], ], Though maybe this reads better... POE::Session->create( object_states => [ $self => [ _start => "_start", ], ], Hope that helps. Cheers, Phil -- Mobile: +1 778-233-4935 Website: http://philw.co.uk Skype: philwhelan76 Twitter: philwhln Email : phil...@gmail.com iChat: philw...@mac.com
Re: POE site not displayed correctly under IE7
Change applied. Thank you, Phil. -- Rocco Caputo - rcap...@pobox.com On Jun 14, 2009, at 00:33, Phil Whelan wrote: Hi Rocco, You can change this in your global.css #navigation { FONT-SIZE: 8pt; WIDTH: 100px } to this... #navigation { float: left; FONT-SIZE: 8pt; WIDTH: 100px } Cheers, Phil
Re: POE site not displayed correctly under IE7
Hello, Now look better, but the whole page is still aligned to the left, rather than center in Firefox/Opera. This is because under quirks mode, the auto margin method is not enough to make IE align your container to the center It can be fixed by adding the following CSS into your global.css body { text-align:center } #container { text-align:left; } On Sun, Jun 14, 2009 at 1:43 PM, Rocco Caputo wrote: > Change applied. Thank you, Phil. > > -- > Rocco Caputo - rcap...@pobox.com > > On Jun 14, 2009, at 00:33, Phil Whelan wrote: > > Hi Rocco, >> >> You can change this in your global.css >> >> #navigation { >>FONT-SIZE: 8pt; WIDTH: 100px >> } >> >> to this... >> >> #navigation { >>float: left; >>FONT-SIZE: 8pt; WIDTH: 100px >> } >> >> Cheers, >> Phil >> > > -- Best Regards, tszming
Re: POE site not displayed correctly under IE7
Change applied, thank you very much. -- Rocco Caputo - rcap...@pobox.com On Jun 14, 2009, at 02:00, Tsz Ming WONG wrote: Hello, Now look better, but the whole page is still aligned to the left, rather than center in Firefox/Opera. This is because under quirks mode, the auto margin method is not enough to make IE align your container to the center It can be fixed by adding the following CSS into your global.css body { text-align:center } #container { text-align:left; } On Sun, Jun 14, 2009 at 1:43 PM, Rocco Caputo wrote: Change applied. Thank you, Phil. -- Rocco Caputo - rcap...@pobox.com On Jun 14, 2009, at 00:33, Phil Whelan wrote: Hi Rocco, You can change this in your global.css #navigation { FONT-SIZE: 8pt; WIDTH: 100px } to this... #navigation { float: left; FONT-SIZE: 8pt; WIDTH: 100px } Cheers, Phil -- Best Regards, tszming
Re: POE site not displayed correctly under IE7
you are welcome. On Sun, Jun 14, 2009 at 2:16 PM, Rocco Caputo wrote: > Change applied, thank you very much. > > -- Rocco Caputo - rcap...@pobox.com > > > On Jun 14, 2009, at 02:00, Tsz Ming WONG wrote: > > Hello, >> >> Now look better, but the whole page is still aligned to the left, rather >> than center in Firefox/Opera. >> >> This is because under quirks mode, the auto margin method is not enough to >> make IE align your container to the center >> >> It can be fixed by adding the following CSS into your global.css >> >> >> body { >>text-align:center >> } >> >> #container { >>text-align:left; >> } >> >> >> >> >> >> On Sun, Jun 14, 2009 at 1:43 PM, Rocco Caputo wrote: >> Change applied. Thank you, Phil. >> >> -- >> Rocco Caputo - rcap...@pobox.com >> >> On Jun 14, 2009, at 00:33, Phil Whelan wrote: >> >> Hi Rocco, >> >> You can change this in your global.css >> >> #navigation { >> FONT-SIZE: 8pt; WIDTH: 100px >> } >> >> to this... >> >> #navigation { >> float: left; >> FONT-SIZE: 8pt; WIDTH: 100px >> } >> >> Cheers, >> Phil >> >> >> >> >> -- >> Best Regards, >> tszming >> > > -- Best Regards, tszming