Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

TAGS and Perl?

by fpi (Monk)
on Apr 06, 2001 at 09:25 UTC ( [id://70403]=perlquestion: print w/replies, xml ) Need Help??

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

Can someone please explain to me what 'tags' are (in reference to programming editors/IDE's) and if they have any benefit or relation to programming in Perl?

In my endless search to find a programming editor for Linux that has any of the basic features of BBedit for Macintosh, I've tried almost every editor/IDE downloadable from freshmeat, linuxapps, and tucows. Some of them have a CTAGS/TAGS feature to which I've never been introduced, nor have I found any definition or explanation.

Keeping an open mind, I've even tried XEmacs on the suggestion of PerlMonks. When a perl script is loaded, there is a Perl menu in the menubar, under which you can find about 6 items referring to 'Tags'. But I can't find anything in the included docs that explains what they are.

The feature I am specifically looking for in an editor is an automatically-generated list of all subroutines within the perl script that you have loaded, i.e. for quick navigation. Both BBedit and Pepper for Macintosh have this, and CodeForge for linux has it. I was hoping these 'Tags' are related to this type of feature.

Replies are listed 'Best First'.
Re: TAGS and Perl?
by arturo (Vicar) on Apr 06, 2001 at 09:46 UTC

    tags is a utility, closely associated with (but not, AFAIK, restricted to use with) vi and vim, "VI iMproved".

    The basic concept's pretty simple, when you run tags on a C source file, it will catalog all your functions and variables (and basically, anything else you can give a name to in C or C++) for you, which makes it easier down the road to debug your code (was hit_count an int or a long? In vi/ vim, run tags and it will save your current place and take you to the file and place in that file where you defined hit_count.)

    Fire up vi or vim, and type in :help tags for how ta use it. Emacs *must* have a facility for working with tags, but it will take an infidel to fill you in on that =)

    I've heard tell that Tom Christiansen wrote such a utility for use with Perl code, but it wasn't in the place I looked for it.

    Philosophy can be made out of anything. Or less -- Jerry A. Fodor

      I've cribbed together a utility to pull module info for use with ctags, so you can jump to a module's subroutine def as well as any subroutines you def in you code. Far from robust (doesn't handle "use libs", for just one example), but it's not hard to build. Tom's utility, no doubt, would work much better.

      ----Asim, known to some as Woodrow.
Re: TAGS and Perl?
by nardo (Friar) on Apr 06, 2001 at 09:43 UTC
    Tags allow you to quickly locate part of your program. See ctags.sourceforge.net for a better explanation.

      This implementation, Exuberant Ctags, is very nice, it even works on VMS systems. I use it all the time in combination with vim to navigate large heaps of messy C++. It turns your editor in something like a source browser. You can just 'click' on a function or class name and jump to its definition and then jump back to the original place again.

      The output of ctags can be used for more things than just aiding an editor. The output is a list of imporant items in your program complete with a regular expression that can be used to find this item in the file. For C++ it even gives the relationships between classes.

      With it, it is easy to write a Perl program that scans a ctags file and then shows you the class hierachy, what methods there are, or even the complexity of your code. The whole problem of parsing the code is taken care of by ctags. ctags is very useful.

      Have Fun

Re: TAGS and Perl?
by the_slycer (Chaplain) on Apr 06, 2001 at 18:49 UTC
    Well, for the specific feature that you are looking for, you might poke at "pride.pl" that ships with Win32::Gui. Yes, I know it's not linux, but it does do the subroutine highlighting, and you could probably edit it to run with Tk instead :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://70403]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2024-04-19 09:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found