in reply to Re^2: POE OO sessions - accessing overwritten methods
in thread POE OO sessions - accessing overwritten methods
Thanks for the update ... although I have to say, I like OO, and I don't like this. I've thought about investigating POE in the past - but something like this would drive me completely away from it. I would rather get named parameters than this. In fact, named parameters would be faster than this, too. I'm really not sure what they're trying to do with this - it's unintuitive, it's ugly, and it's slow. (Funny how that works in perl - often the intuitive, clean solutions are pretty darned close to the fastest, too.)
#! /usr/bin/perl use Benchmark qw(cmpthese); use constant {OBJECT => 0, KERNEL => 1, HEAP => 2, SESSION => 3, }; cmpthese( 0, { POE => sub { poe_style(qw(a b c d)); }, Normal => sub { regular_style(qw(a b c d)); }, Named => sub { named_style('a', kernel => 'b', heap => 'c', session => 'd', ); }, Shift => sub { shift_style(qw(a b c d)); }, } ); sub poe_style { my ($self, $kernel, $heap, $session) = @_[ OBJECT, KERNEL, HEAP, S +ESSION ]; 0; } sub regular_style { my $self = shift; my ($kernel, $heap, $session) = @_; 0; } sub named_style { my $self = shift; my %opts = @_; 0; } sub shift_style { my $self = shift; my $kernel = shift; my $heap = shift; my $session = shift; 0; }
Update:Typo fixed, changing the way the benchmark worked. Still find it ugly :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: POE OO sessions - accessing overwritten methods
by m-rau (Scribe) on Feb 12, 2005 at 16:29 UTC | |
by Tanktalus (Canon) on Feb 12, 2005 at 16:48 UTC | |
by BrowserUk (Patriarch) on Feb 12, 2005 at 18:53 UTC | |
by Tanktalus (Canon) on Feb 12, 2005 at 19:23 UTC | |
|
Re^4: POE OO sessions - accessing overwritten methods
by BrowserUk (Patriarch) on Feb 12, 2005 at 18:54 UTC |