Permalink
Browse files

Refactor Logger->log to avoid creating a POE::Session.

A major refactoring of Logger->log/P:C:L->log to remove the creation of
an ephemerous POE::Session that was used just for sending the message
to our logger session.
The code change is low, but it may have big impact. Probably not because
the _start event is called synchronously in POE::Session->create().
Anyway, our extensive test suite passes.
  • Loading branch information...
1 parent 3b3ff76 commit f42388e78baae581b334628a63a71d09f77575cb @dolmen committed Oct 26, 2010
Showing with 2 additions and 12 deletions.
  1. +2 −12 lib/POE/Component/Logger.pm
@@ -66,22 +66,12 @@ sub _poe_log {
}
sub log {
- my $class = shift;
- POE::Session->create(
- inline_states => {
- _start => \&_start_logging,
- },
- args => [ @_ ],
- );
+ my ($class, @args) = @_;
+ POE::Kernel->post(logger => log => @args);
}
*Logger::log = \&log;
-sub _start_logging {
- my ($kernel, @args) = @_[KERNEL, ARG0..$#_];
- $kernel->post(logger => log => @args);
-}
-
1;
__END__

0 comments on commit f42388e

Please sign in to comment.