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

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

 



On Sat, Feb 07, 2009 at 12:21:13AM +0100, Thomas Rast wrote:

> > (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.

Right, you would still need the parentheses. But note that the second
syntax (with the "->") would always be wrong. The "::" syntax just says
"find this name not in the current namespace, but in this absolute
namespace I am giving you". But "X->Y" is actually a syntactic shorthand
for "look up X::Y (or Z::Y, where Z is the blessed package of X), and
then call X::Y(X, @_)".

Which makes sense for object-oriented stuff. You get the object or the
classname as the first parameter to a method. But for a regular package
function, you would be calling

  Term::ReadKey::ReadKey('Term::ReadKey', 0)

which of course makes no sense.

But I think doing the import makes more sense (and is how Term::ReadKey
is intended to be used), so the patch you posted is best.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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