Learning Perl Objects, References amp;amp; Modules [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Learning Perl Objects, References amp;amp; Modules [Electronic resources] - نسخه متنی

Randal L. Schwartz

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید














9.12 Faster Getters and Setters


Because
you're going to play nice and always call the
getters and setters instead of reaching into the data structure,
getters and setters are called frequently. To save a teeny-tiny bit
of time, you might see these getters and setters written as:

## in Animal
sub color {
$_[0]->{Color}
}
sub set_color {
$_[0]->{Color} = $_[1];
}

Here's an alternate way to access the arguments:
$_[0] is used in place, rather than with a
shift. Functionally, this example is identical to
the previous implementation, but it's slightly
faster, at the expense of some ugliness.



/ 199