remiah has asked for the wisdom of the Perl Monks concerning the following question:

Object Oriented Perl tends to have many many modules. So I want to know good way to jump through the source code.

Once I used ctags command? with vim, it enabled me jump to functions once I created index with the command.(I forgot the name of the command, nor usage of that...)

I am using vim with Freebsd, but any other method than vim are welcome if it enables me to jump higher.

regards.

Replies are listed 'Best First'.
Re: Jumping through perl modules with vim
by roboticus (Chancellor) on Jan 21, 2011 at 03:36 UTC

    remiah:

    I've been meaning to give ctags a try, so I took a quick look via google and found that it supports perl, so I'll have to give it a try in the morning. The page I found gives a sample invocation as something like this:

    ctags -f tags --recurse --totals \ --exclude=blib --exclude='*~' \ --languages=Perl --langmap=Perl:+.t

    Update: Another thread here on perlmonks mentions a pltags.pl script that comes with vim, and a module by osfameron. I'll have to look into those as well.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      thanks for reply. I didn't know I already have pltags.pl .
      I thought I used to create symbolic links for recursive directrories, so I did it like this.
      #make tags file find ./ | xargs pltags.pl #replace ./ with fullpath ...space character of [] is tab... cat tags | sed 's^[ ]\./^[ ]'`pwd`'/^' > .buff mv .buff tags #create symlink find . -type d -exec ln -s `pwd`/tags {}/tags \;
      But "Another thread" told me if I set tags=path/to/tagfile value on vim, this is completly needless. "Another thread" was also good for me because I forgot the key for jump Ctrl+], back Ctrl+T. It was very helpful for me.
Re: Jumping through perl modules with vim
by fisher (Priest) on Jan 21, 2011 at 11:31 UTC
    "I am using vim with Freebsd, but any other method than vim are welcome if it enables me to jump higher."

    I personally use lightweight IDE called geany on a linux desktop. This small IDE knows about perl syntax and jumps into other files (with function definition) within the project by a simple keystroke.

    Also for emacs there is etags, I used to use it before.

    If you intend to use it only with perl, I suggest to look closely at PADRE.

      I tried PADRE. It took long time to compile but lighter than I thought. IDE with debugger is fascinating for me. For jumping through facilities it seems the same mechanism with ctags. Suppose you are editing BBB/Bar.pm and wonder what is function aaa?
      #AAA/Some.pm package some; sub aaa{}; 1; #BBB/Foo.pm package foo; sub aaa{} ; 1; #BBB/Bar.pm package bar; use base qw(foo); sub bbb{ aaa(); } 1;
      ctags generate sorted list for aaa like this.
      aaa AAA/Some.pm aaa BBB/Bar.pm
      If class hierarchy took considered, they must jump to BBB/Bar.pm's function aaa, but Padre and ctags jump to AAA/Some.pm's function aaa. I guess they use same logic and jump to first line of sorted list.

      Just type g+Ctrl+] show me list of functions in ctags and vim. It is enough good to me so far. In reality, we have factory class? or something, so, much or less I have to jump with my legs.
Re: Jumping through perl modules with vim
by elTriberium (Friar) on Jan 21, 2011 at 20:24 UTC
    You can use cscope, it also works with Perl sources. Just google for it.