Author: bdonlan
Date: 2004-06-29 15:14:28 -0400 (Tue, 29 Jun 2004)
New Revision: 279
Modified:
trunk/misc/poe-eventsource/lib/POE/Session/EventSource.pm
Log:
* poe-eventsource/lib/POE/Session/EventSource.pm
Add an option to pass options to POE::Session::Inheritable, and thus to
POE::Session->create
Modified: trunk/misc/poe-eventsource/lib/POE/Session/EventSource.pm
===================================================================
--- trunk/misc/poe-eventsource/lib/POE/Session/EventSource.pm 2004-06-29
19:12:32 UTC (rev 278)
+++ trunk/misc/poe-eventsource/lib/POE/Session/EventSource.pm 2004-06-29
19:14:28 UTC (rev 279)
@@ -73,25 +73,26 @@
return $self->SUPER::_object_states($ehash);
}
-=head2 new([prefix => $Z<>prefix])
+=head2 new([prefix => $Z<>prefix], [EMAIL PROTECTED]<>args])
Creates a new instance of a POE::Session::EventSource. $prefix, if present,
will be prepended to all events to obtain the event name to be dispatched to
-client sessions.
+client sessions. @args will be passed to POE::Session::Inheritable.
=cut
sub new {
my ($class, %args) = @_;
if ((ref $class || $class) eq __PACKAGE__
- and !$args{force_nosuper}) {
+ and !delete($args{force_nosuper})) {
carp "Warning! You probably don't want to create an instance of
POE::Session::EventSource directly.\n",
"If you're sure, you can suppress this warning by
passing force_nosuper => 1";
}
- my $self = $class->SUPER::new();
+ my $prefix = delete $args{prefix};
+ my $self = $class->SUPER::new(%args);
- if ($args{prefix}) {
- $self->{prefix} = $args{prefix};
+ if ($prefix) {
+ $self->{prefix} = $prefix;
} else {
$self->{prefix} = '';
}