[Moscow.pm] refactoring

Andrey Asyakin asan999 на gmail.com
Пт Окт 16 08:00:57 PDT 2015


>
> Как-то так...
>

my ($father, $mother, $email, $homepage, $date_of_birth) = (
>   $person->get_father // undef,
>   $person->get_mother // undef,
>   $person->get_email // undef,
>   $person->get_homepage // undef,
>   $person->get_date_of_birth // undef
> );
>

> $person->get_father // undef
> Такое выражение вообще имеет смысл?
> оставить просто
> $person->get_father

Вообще говоря, имеет, если эти get_father/mother возвращают пустой список в
списковом контексте.
Хотя этот вариант кода выглядит еще хуже, чем вариант топикстартера,
который можно отформатировать нормально и не париться. либо переписать все

16 октября 2015 г., 16:57 пользователь Oleg Alexeenkov <proler на gmail.com>
написал:

> Илья Винокуров <ilvin на mail.ru> писал(а) в своём письме Thu, 15 Oct 2015
> 09:55:18 +0300:
>
> Как-то так...
>>
>
> my ($father, $mother, $email, $homepage, $date_of_birth) = (
>>   $person->get_father // undef,
>>   $person->get_mother // undef,
>>   $person->get_email // undef,
>>   $person->get_homepage // undef,
>>   $person->get_date_of_birth // undef
>> );
>>
>
> $person->get_father // undef
> Такое выражение вообще имеет смысл?
> оставить просто
> $person->get_father
>
>
> push @person_row,
>>     $father && $father->get_id,
>>     $mother && $mother->get_id,
>>     $email,
>>     $homepage,
>>     $date_of_birth ? join('/', $date_of_birth->day // '',
>> $date_of_birth->month // '', $date_of_birth->year // '') : '';
>>
>
> no warnings qw(uninitialized);
> и не надо этих // ''
>
> --
> Moscow.pm mailing list
> moscow-pm на pm.org | http://moscow.pm.org
>
----------- следущая часть -----------
Вложение в формате HTML было извлечено…
URL: <http://mail.pm.org/pipermail/moscow-pm/attachments/20151016/651caa4c/attachment.html>


Подробная информация о списке рассылки Moscow-pm