[Moscow.pm] how to overload "<>" ?
Sergey Aleynikov
sergey.aleynikov на gmail.com
Вт Фев 2 12:03:54 PST 2016
Добрый день,
> overload говрит, что можно перегуржать <>
> "Iteration
> If <> is overloaded then the same implementation is used for both the
> read-filehandle syntax <$var> and globbing syntax<${var}>.
> "
>
> но как??
Точно так же, как и любой другой overload:
use 5.020;
use overload "<>" => sub {state $i=10; $i?--$i:undef};
my $f=bless {};
warn $_ while (<$f>);
Best regards,
Sergey Aleynikov
Подробная информация о списке рассылки Moscow-pm