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

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

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

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

Randal L. Schwartz

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

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

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














14.7 Exercise


The answers for all exercises can be found in Section A.12.


14.7.1 Exercise [60 min]


Write a module distribution, starting from the tests first.

Your goal is to create a module My::List::Util
that exports two routines on request: sum and
shuffle. The sum routine takes
a list of values and returns the numeric sum. The
shuffle routine takes a list of values and
randomly shuffles the ordering, returning the list.

Start with sum. Write the tests, and then add the
code. You'll know you're done when
the tests pass. Now include tests for shuffle, and
then add the implementation for shuffle.

Be sure to update the documentation and MANIFEST
file as you go along.

If you can pair up with someone on this exercise, even better. One of
you writes the test for sum and the implementation
code for shuffle, and the other does the opposite.
Swap the t/* files, and see if you can locate any
errors!



/ 199