Полезная информация

Programming Perl

Programming PerlSearch this book
Previous: 3.2.8 binmodeChapter 3
Next: 3.2.10 caller

3.2.9 bless

bless REF

This function looks up the item pointed to by reference REF and tells the item that it is now an object in the CLASSNAME package - or the current package if no CLASSNAME is specified, which is often the case. It returns the reference for convenience, since a bless is often the last thing in a constructor function. (Always use the two-argument version if the constructor doing the blessing might be inherited by a derived class. In such cases, the class you want to bless your object into will normally be found as the first argument to the constructor in question.) See "Objects" in Chapter 5, Packages, Modules, and Object Classes for more about the blessing (and blessings) of objects.

Previous: 3.2.8 binmodeProgramming PerlNext: 3.2.10 caller
3.2.8 binmodeBook Index3.2.10 caller