Garbage collection in Perl does not happen asychronously, but is entirely deterministic (except for the order in which objects are freed during global destruction at the end of a program). When the reference count on an object drops to zero, it is destroyed immediately. Although Java allows you to inherit from only one concrete base class and multiple abstract classes, Perl makes no distinction between the two kinds of class and says that you can do as much multiple inheritance as you like. You may find that your fears about incestuous inheritance relationships do not come to pass, however. Reflection in Perl is accomplished by several methods. If the object $obj is implemented as a hash, you can discover its set of attributes with keys%$obj. You can find out if it supports a given method methwith $obj->can(’meth’), and you can get a list of all the methods it supports by traversing the symbol table for the package looking for subroutines. Finally, you can construct its inheritance hierarchy by following the @ISA array package variable or by using the CPAN module Class::ISA (http://search.cpan.org/search?dist=Class-ISA) which provides a friendly interface for that. Finalizer chaining does not happen automatically in Perl either the Perl term for finalizeis DESTROY and for much the same reasons as in Java. In keeping with the Perl philosophy of permissiveness, there is no equivalent of finalto prevent a method from being overridden in a derived class. 12.5.2 Specific Tips for the C++ Programmer The lack of strong typing which probably seemed liberating to the C programmer probably seems offensive to you. (Perl may seem irritatingly free-form until you grasp the Perl ethos.) Perl does have operator overloading, although it isn’t used as often as you’d think. perldocoverload tells you all about it. Because Perl doesn’t have strong typing, you won’t need to construct template classes for generic operations since they’re generic to begin with. We personally find the use of references in C++ to be annoying, because a change in a function prototype can change the actual value that is passed in a call to the function. If you actually like this feature, you can replicate it after a fashion with what Perl calls subroutine prototypes. They won’t look like prototypes to you they’re more like patterns specifying the order and types of arguments that can be passed but one of the consequences is that you can construct a prototype that will allow a subroutine to be called with an array and receive a reference to that array where it would normally receive the list of all the elements in the array. We suggest you not be too hasty to avail yourself of this feature, primarily because unlike C++, Perl does not require prototypes to be declared in order for a program to work, and if yours somehow fail to get declared or get declared too late then the semantics of your program will change in wonderfully unpredictable ways. Chapter 13. Debugging CGI Programs
Hint: This post is supported by Gama besplatan domen provider