[poe-commits] SF.net SVN: poe:[2503] trunk/poe/lib/POE/Component/Server/TCP.pm
Brought to you by:
rcaputo
From: <ap...@us...> - 2009-03-11 18:02:30
|
Revision: 2503 http://poe.svn.sourceforge.net/poe/?rev=2503&view=rev Author: apocal Date: 2009-03-11 18:02:21 +0000 (Wed, 11 Mar 2009) Log Message: ----------- Use POE::Kernel::ASSERT_USAGE as recommended by rcaputo + POD tweaks Modified Paths: -------------- trunk/poe/lib/POE/Component/Server/TCP.pm Modified: trunk/poe/lib/POE/Component/Server/TCP.pm =================================================================== --- trunk/poe/lib/POE/Component/Server/TCP.pm 2009-03-11 17:47:37 UTC (rev 2502) +++ trunk/poe/lib/POE/Component/Server/TCP.pm 2009-03-11 18:02:21 UTC (rev 2503) @@ -172,37 +172,39 @@ # Sanity check, thanks to crab@irc for making this mistake, ha! # TODO we should could move this to POE::Session and make it an "sanity checking" sub somehow... - foreach my $t ( qw( _start _stop _child shutdown - tcp_server_got_high tcp_server_got_low - tcp_server_got_input tcp_server_got_error tcp_server_got_flush - ) ) { - if (exists $inline_states->{$t}) { - croak "Overriding '$t' in InlineStates is not allowed!"; - } - for (my $i = 1; exists $package_states->[$i]; $i += 2) { - if (defined $package_states->[$i] and ref($package_states->[$i]) eq 'HASH') { - if (exists $package_states->[$i]{$t}) { - croak "Overriding '$t' in PackageStates is not allowed!"; + if (POE::Kernel::ASSERT_USAGE) { + foreach my $t ( qw( _start _stop _child shutdown + tcp_server_got_high tcp_server_got_low + tcp_server_got_input tcp_server_got_error tcp_server_got_flush + ) ) { + if (exists $inline_states->{$t}) { + croak "Overriding '$t' in InlineStates is not allowed!"; + } + for (my $i = 1; exists $package_states->[$i]; $i += 2) { + if (defined $package_states->[$i] and ref($package_states->[$i]) eq 'HASH') { + if (exists $package_states->[$i]{$t}) { + croak "Overriding '$t' in PackageStates is not allowed!"; + } + } elsif (defined $package_states->[$i] and ref($package_states->[$i]) eq 'ARRAY') { + if (grep { $_ eq $t } @{ $package_states->[$i] }) { + croak "Overriding '$t' in PackageStates is not allowed!"; + } + } else { + croak "Unknown argument in PackageStates index $i"; } - } elsif (defined $package_states->[$i] and ref($package_states->[$i]) eq 'ARRAY') { - if (grep { $_ eq $t } @{ $package_states->[$i] }) { - croak "Overriding '$t' in PackageStates is not allowed!"; - } - } else { - croak "Unknown argument in PackageStates index $i"; } - } - for (my $i = 1; exists $object_states->[$i]; $i += 2) { - if (defined $object_states->[$i] and ref($object_states->[$i]) eq 'HASH') { - if (exists $object_states->[$i]{$t}) { - croak "Overriding '$t' in ObjectStates is not allowed!"; + for (my $i = 1; exists $object_states->[$i]; $i += 2) { + if (defined $object_states->[$i] and ref($object_states->[$i]) eq 'HASH') { + if (exists $object_states->[$i]{$t}) { + croak "Overriding '$t' in ObjectStates is not allowed!"; + } + } elsif (defined $object_states->[$i] and ref($object_states->[$i]) eq 'ARRAY') { + if (grep { $_ eq $t } @{ $object_states->[$i] }) { + croak "Overriding '$t' in ObjectStates is not allowed!"; + } + } else { + croak "Unknown argument in ObjectStates index $i"; } - } elsif (defined $object_states->[$i] and ref($object_states->[$i]) eq 'ARRAY') { - if (grep { $_ eq $t } @{ $object_states->[$i] }) { - croak "Overriding '$t' in ObjectStates is not allowed!"; - } - } else { - croak "Unknown argument in ObjectStates index $i"; } } } @@ -888,9 +890,9 @@ listening session, not to every connection. A yield() in a connection will not reach these handlers. -The constructor will croak() if it detects a state that it uses internally, -so please don't do this. For example, please use the "Started" callback if you -want to specify your own "_start" event. +If POE::Kernel::ASSERT_USAGE is enabled, the constructor will croak() if it +detects a state that it uses internally. For example, please use the "Started" +callback if you want to specify your own "_start" event. =head4 ObjectStates @@ -902,9 +904,9 @@ listening session, not to every connection. A yield() in a connection will not reach these handlers. -The constructor will croak() if it detects a state that it uses internally, -so please don't do this. For example, please use the "Started" callback if you -want to specify your own "_start" event. +If POE::Kernel::ASSERT_USAGE is enabled, the constructor will croak() if it +detects a state that it uses internally. For example, please use the "Started" +callback if you want to specify your own "_start" event. =head4 PackageStates @@ -917,9 +919,9 @@ listening session, not to every connection. A yield() in a connection will not reach these handlers. -The constructor will croak() if it detects a state that it uses internally, -so please don't do this. For example, please use the "Started" callback if you -want to specify your own "_start" event. +If POE::Kernel::ASSERT_USAGE is enabled, the constructor will croak() if it +detects a state that it uses internally. For example, please use the "Started" +callback if you want to specify your own "_start" event. =head4 Port This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |