From: Junio C Hamano Date: Sat, 07 Feb 2009 07:50:00 GMT Subject: Re: [PATCH] add -p: import Term::ReadKey with 'require' Message-ID: <7v8woiznx3.fsf@gitster.siamese.dyndns.org> In-Reply-To: <20090207045401.GA21135@sigill.intra.peff.net> Jeff King writes: > 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. Ok, will queue.