Re: [PATCH] add -p: import Term::ReadKey with 'require'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King wrote:
> I believe it is fine. The tricky thing is that perl's parsing is
> dependent on what functions have been defined. So it is OK to say
> 
>   ReadKey 0;
> 
> if a subroutine ReadKey has been defined, but otherwise it generates a
> warning about using the bareword as a function. However
> 
>   ReadKey(0);
> 
> parses unambiguously, so it is always OK, even if no subroutine has yet
> been defined.

Ok, that explains a lot.  I always thought Perl had a syntax
influenced somewhat by the functional programming languages, where the
parentheses are usually optional.  Clearly not so.

> (note that you could also skip the import and just call
> Term::ReadKey::ReadKey by its full name).

I tried that but couldn't get either Term::ReadKey::ReadKey or
Term::ReadKey->ReadKey to work.  In retrospect, I suppose it requires
parentheses too.

Thanks for the review!

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux