|Syntactic Confectionery Delight|
Perl semi-object without a constructorby Wiggins (Hermit)
|on Feb 20, 2013 at 18:23 UTC||Need Help??|
Wiggins has asked for the
wisdom of the Perl Monks concerning the following question:
Please be tolerant, and read through to the end. I am trying to wrap my head arround some OO Perl that doesn't match the style of any of the examples I can find. The code ths that Msg.pm from
"Advanced Perl Programming By Sriram Srinivasan 1st Edition 1997".
Only some parts are in the book, but it is all tied together in
Connect lists 4 paramaters, 3 are used here.
The calling code in "msgdemo.pl":
'new_server()' is called with only 3 arguments, not 4! But it works. The '$pkg' is used a bit later in this code:
From the comment, an object was created. The reference is the anonymous hash with 2 members, and the class name is what? $pkg appears to be an undefined scalar?
From the prior 'bless', a $conn has no methods, but the
looks like _send is a method of the $conn object. Is that a shorthand or alternate form of
of a Perl convention to have a non object method work with this object.
This --server code listens on only one port, and I am trying to generalize it to manage multiple listen sockets and support UDP as well as TCP.
It is always better to have seen your target for yourself, rather than depend upon someone else's description.