Use of POE within a module

howard chen <[email protected]>
Newsgroups gmane.comp.lang.perl.poe
Message-ID <[email protected]>
Hello,

Most example put callback function as global, e.g.

http://search.cpan.org/dist/POE-Component-Client-NNTP/lib/POE/Component/Client/NNTP.pm

POE::Session->create(
        package_states => [
                'main' => { nntp_disconnected => '_shutdown',
                            nntp_socketerr    => '_shutdown',
                            nntp_421          => '_shutdown',
                            nntp_200          => '_connected',
                            nntp_201          => '_connected',
                },
                'main' => [ qw(_start nntp_211 nntp_220 nntp_223
nntp_registered)
                ],
        ],
   );



How about if the callback I want to call the fucntion inside a module?

POE::Session->create(
		package_states => [
			'main' => {
				nntp_disconnected => 'MyModule::_shutdown',
				nntp_socketerr    => 'MyModule::_shutdown',
				nntp_421          => 'MyModule::_shutdown',
				nntp_200          => 'MyModule::_connected',
				nntp_201          => 'MyModule::_connected',
			},
			'main' => [
				qw(MyModule::_start MyModule::nntp_211 MyModule::nntp_220
MyModule::nntp_223 MyModule::nntp_registered)
			],
		],
	);

Of cause the above one is not correct.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.