Perl Best Practices [Electronic resources] نسخه متنی

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

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

Perl Best Practices [Electronic resources] - نسخه متنی

Damian Conway

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

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

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







B.8. Chapter 9, Subroutines


  • Call subroutines with parentheses but without a leading &. [Call Syntax ]

  • Don't give subroutines the same names as built-in functions. [Homonyms ]

  • Always unpack @_ first. [Argument Lists ]

  • Use a hash of named arguments for any subroutine that has more than three parameters. [Named Arguments ]

  • Use definedness or existence to test for missing arguments. [Missing Arguments ]

  • Resolve any default argument values as soon as @_ is unpacked. [Default Argument Values ]

  • Always return scalar in scalar returns. [Scalar Return Values ]

  • Make list-returning subroutines return the "obvious" value in scalar context. [Contextual Return Values ]

  • When there is no "obvious" scalar context return value, consider Contextual::Return instead. [Multi-Contextual Return Values ]

  • Don't use subroutine prototypes. [Prototypes ]

  • Always return via an explicit return. [Implicit Returns ]

  • Use a bare return to return failure. [Returning Failure ]



/ 317