Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Re: PerlMonks MUD in progress

by l2kashe (Deacon)
on Jul 14, 2003 at 12:49 UTC ( [id://273959]=note: print w/replies, xml ) Need Help??


in reply to Re^2: PerlMonks MUD in progress
in thread PerlMonks MUD in progress

Heh, fight the good fight brother.. ;)

Seriously though. I too was fairly overwhelmed by the initial docs. Until you really grok what is available with POE it all seems so daunting. The way I got over it was I grabbed a perl based mud from sourceforge (I believe its called poe-mud, or some such), and hit http://poe.perl.org. On the poe site there is a simple chat server that I used as my base, and I have been extending since. If memory serves this is all it takes to get a full fledged TCP based server up and functional. ready?
#!/usr/bin/perl use strict; use POE qw( Component::Server::TCP ); POE::Component::Server::TCP->new( Alias => "MUD", Port => '30000', InlineStates => { 'send' => \&handle_send, }, ClientError => \&c_error, ClientInput => \&c_input, ClientConnected => \&c_connect, ClientDisconnected => \&c_disconnect, ); $poe_kernel->run();
So the server has predefined events, when those events happen the routines referenced on the right are called.

In regards to the heap, as far as I have been able to understand it the heap is just that. A session's very own memory space. So that in sub_A you could set $heap->{some_key} = 1, and in sub_B do if ( $heap->{some_key}). The heap is there to get around shared memory issues I think.

At any rate, stick with POE. I know its disconcerting, but the beauty and power of those modules are simply breathtaking for me. At some point I do believe I will be helping that project out, as it is so useful.

Spend time reading POE::Kernel, and POE::Session. Once you really grok those 2 modules, then the rest just kind of falls into place. Also grab something written using POE and pull it apart, play with it, and make something slightly different. At some point the light will come on, and you will probably say "Holy @(#$, thats all it takes to do that?!?"

Update: altered poe.perl.com -> poe.perl.org :P

MMMMM... Chocolaty Perl Goodness.....

Replies are listed 'Best First'.
Re^3: PerlMonks MUD in progress
by Coruscate (Sexton) on Jul 14, 2003 at 17:33 UTC

    Thank you very much for that l2kashe. I will follow your advice. It looks much simpler. And as for the heap explanation, that helps a heck of a lot. So thanks again. Off to read some more POE docs I think :)


    If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, please reply to this node or /msg me to inform me as to what is wrong with the post, so that I may update the node to the best of my ability.

      I poked around the Tutorials briefly, and didn't see anything on POE. I think I might try and start in on one. While the docs are good, they have a fairly high learning curve for the uninitiated. There is also poe.perl.org, but I think the topic is large enough, and the modules are useful enough that it deserves its own tutorial here. So with that in mind, be on the lookout ;)

      P.s: I'll probably hork the initial explanation pretty good, but there is no better way to learn something than to try and teach it, and hopefully the community will chip some input in too.

      Update: Altered poe.perl.com -> poe.perl.org per Mr. Muskrat ;)

      MMMMM... Chocolaty Perl Goodness.....

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://273959]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-25 06:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found