Thursday, January 2, 2014

Re: Relation between the :version command showing +perl/dyn and "echo has ("perl") returning 1.

On 02/01/14 10:50, Pritesh Ugrankar wrote:
> On Thursday, January 2, 2014 3:12:27 PM UTC+5:30, Tony Mechelynck wrote:
>> On 02/01/14 10:08, Pritesh Ugrankar wrote:
>>
>>> Hi,
>>
>>>
>>
>>> Vim newbie here.
>>
>>>
>>
>>> Please let me know the relation between the :version command showing +perl/dyn and "echo has ("perl") returning 1.
>>
>>>
>>
>>> I am using gVim7.4 (downloaded from www.vim.org) on Windows 7.
>>
>>>
>>
>>> I had earlier installed Strawberry Perl version 5.16.3 (32 Bit) and at that time, for "echo has ("perl").would return 0.
>>
>>>
>>
>>> Recently removed that version of Perl and installed DWIM Perl Version 5.14.2.1 (32 Bit).
>>
>>>
>>
>>> Now vim returns "1" for "echo has ("perl").
>>
>>>
>>
>>> What does this mean? Will this enable me to do something that I was not doing earlier.
>>
>>>
>>
>>> When I googled a bit, now I understand that I can run "%perldo s/this/that/gi". But apart from this, what are the advantages that I have now?
>>
>>>
>>
>>> Kindly let me know.
>>
>>>
>>
>>
>>
>> +perl/dyn means Vim was compiled with the Perl interface dynamically
>>
>> included. In that case the perl commands can be used (and has('perl')
>>
>> will return 1) if the perl libraries (of the correct version) can be
>>
>> found at run-time by the Vim executable. If the perl libraries cannot be
>>
>> found, the same executable will have has('perl') returning zero, and the
>>
>> Perl interface cannot be used then. The output of :version should give
>>
>> you, somewhere in the "Compilation:" and "Linking:" paragraphs in the
>>
>> bottom half of the listing, the arguments which were used to invoke the
>>
>> Perl include files and/or the Perl libraries; from that you ought to be
>>
>> able to determine which Perl version Vim will be looking for.
>>
>>
>>
>> +perl (without /dyn) means that the Perl libraries were included
>>
>> statically, which makes for a bulkier executable, but no dependency on
>>
>> something which might or might not be found at run-time. In that case
>>
>> has('perl') will always return 1.
>>
>>
>>
>> -perl of course means that the Perl interface was completely excluded at
>>
>> compile-time, so has('perl') will always return 0.
>>
>>
>>
>> The output of :version is fixed at compile-time, so it cannot show
>>
>> anything that is only known at run-time.
>>
>>
>>
>> Similarly for +python/dyn, +ruby/dyn, +tcl/dyn etc.
>>
>>
>>
>>
>>
>> Best regards,
>>
>> Tony.
>>
>> --
>>
>> Ye gods! Give me strength to suffer what cannot be changed, courage to
>>
>> change
>>
>> what must be changed, and wisdom to tell the two apart.
>>
>> -- Marcus Aurelius
>
> Hi Tony,
>
> Thank you very much for the reply. Does the +perl/dyn or +perl help in syntax highlighting/autocompletion? Or is there some other advantage of that? I will be extremely thankful if you could let me know.
>

IIUC, even a Vim with -perl (i.e. no Perl features at all) can highlight
Perl source files correctly. What it cannot do is run the commands :perl
and :perldo. Also it cannot use Perl here-scripts, and to wrap those in
:if has('perl') special precautions must be taken, see :help script-here


Best regards,
Tony.
--
New York now leads the world's great cities in the number of people around
whom you shouldn't make a sudden move.
-- David Letterman

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment