On Thu, Jan 17, 2002 at 03:51:09PM +0100, Arthur Bergman wrote:

> Below is an interesting code snippet that allows us to use the
> following syntax
> 
> use PoCo::Server::HTTP;
> PoCo::Server::HTTP->new();
> 
> I didn't send it as a patch because I wouldn't know where to put it
> and I was thinking perhaps more discussion is needed.

[coderef in @INC code]


I was looking for a way to incorporate this into 0.1703, but its
implications for portability make it kind of a pain.

Some observations:

Coderefs in @INC do not port as far back as POE does.

Components themselves still need to be in the POE::Component
namespace.

Components need to use the long form of POE::Component regardless of
the presence of PoCo::.

Only programs that don't need to worry about backward portability to
old versions of Perl need apply.

The @INC coderef could be made a little more generic so that it
aliases many things.  C<use alias ( "OldName", "NewName" );>

Clobbering namespaces or @ISA leaves holes in namespaces that may
later hold real modules.

The global nature of @ISA coderefs makes them action at a distance.
Unsuspecting modules may break when packages are shuffled without
their knowledge.

So... I'm not going to be adding this to 0.18 in any form, but it may
go in later versions as something else.  Sorry about that.

As a consolation, POE::Preprocessor has been able to do this at the
file scope for several months:

  use POE::Preprocessor;
  const PoCo POE::Component

That has its own set of problems.  I think it's a smaller list though,
and its side effects aren't as far-reaching.  It also works as far
bask as POE does, so writing portable code is a little easier.

> yes, this is also an announcment for POE::Component::Server::HTTP
> 0.01, it is on PAUSE now, CPAN soon, enjoy

Yay!  Now I need to retrofit some programs to use it.

-- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sf.net

Reply via email to