Finding Subroutines


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Finding Subroutines
# 1  
Old 12-21-2009
Finding Subroutines

I'm maintaining a variety of programs (mostly in Perl) I didn't build, and the perllib is huge on the server. When I run across a user-defined subroutine it takes me at least an hour to look through all the logical places, and sometimes I still can't find the definition.

Is there an easy way to search all the files for a subroutine definition? My file search doesn't seem to do it. Thanks!
# 2  
Old 12-21-2009
You may want to search for lines that begin 0 or more whitespace followed by "sub".

tyler_durden
# 3  
Old 12-21-2009
Look at the cscope utility. It is not just limited to C or C++ codebases but with work with Perl, Python and more.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Subroutines; am I capturing them correctly?

HI Folks - Again, I'm very sorry for the amateur post. I'm reletively new to shell scripting so please bear with me. I have a script that execute another script which stops a particular set of services for my application. IF the execution is successful, I want to check for any hung ESSSVR... (4 Replies)
Discussion started by: SIMMS7400
4 Replies

2. Shell Programming and Scripting

how to obtain a variable between subroutines

#!/usr/bin/bash sub1 () { for ((i=0;i<10;i++)) do export a=$i; echo "value of a is $a"; sleep 1 done } sub1 & sub2 () { for ((j=0;j<10;j++)) do echo "value of a is $a"; sleep 1 done } (5 Replies)
Discussion started by: Arun_Linux
5 Replies

3. Shell Programming and Scripting

How can i use switches type arguments for subroutines in perl

i want to call subroutines in perl like: sub temp { ---- some code ----- } temp(-switchName, value1, --switchName2, value2) Like i know getoptions::Long is there for command line switches type arguments. So i want to know for subroutine type arguments. (1 Reply)
Discussion started by: Navrattan Bansa
1 Replies

4. Shell Programming and Scripting

finding first >

I want to erase some php code between a <? and a ?> in HTML containing a keyword, the problem is it finds the last > and wipes out everything before it how do i specify for it to stop searching after the first >? perl -i -p0e 's/<\?php.*keyword.*\?>//s' there's many lines of php code... (2 Replies)
Discussion started by: vanessafan99
2 Replies

5. Homework & Coursework Questions

Help with perl subroutines

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: This subroutine needs to check if there was a file name given on the command line. If so, return that. Otherwise... (1 Reply)
Discussion started by: yonkers062986
1 Replies

6. Shell Programming and Scripting

How to get the return code of subroutines executed as standalone as command line in Perl ?

How to do I get the return code of a subroutine in a perl module if invoke the subroutine as standalone, I have an module say TestExit.pm and in that i have a subroutine say myTest() which is returns 12, if i were to call the subroutine from command line like CASE:1 ( Without an explict... (2 Replies)
Discussion started by: ennstate
2 Replies

7. Shell Programming and Scripting

finding duplicate files by size and finding pattern matching and its count

Hi, I have a challenging task,in which i have to find the duplicate files by its name and size,then i need to take anyone of the file.Then i need to open the file and find for more than one pattern and count of that pattern. Note:These are the samples of two files,but i can have more... (2 Replies)
Discussion started by: jerome Sukumar
2 Replies

8. UNIX for Dummies Questions & Answers

Finding how done IT

HellOooO, How I can find how delete a drictory in the system.If there's 2 root one of them outside the country but we have WAN so he can access the network from outside >>>> we are using same account so how I can know who done it I want to proof that. Regards (5 Replies)
Discussion started by: geoquest
5 Replies

9. UNIX for Dummies Questions & Answers

Passing Hash Tables to Subroutines

Hi: How do I pass a hash table down to a subroutine along with some other variables? For example, I have say a subroutine play_with_hash: sub play_with_hash { my( $var1, $var2, %my_hash ) = @_; #do stuff with %my_hash ........... } Then I want to call the subroutine... (1 Reply)
Discussion started by: mirzabhai
1 Replies

10. UNIX for Dummies Questions & Answers

shell scripting: calling subroutines

How do I define and call a subroutine in a ksh script (or any shell)? I'm writing a script that uses a lot of the same code over and over and I don't want to waste time/space. Thanks, Chuck (2 Replies)
Discussion started by: 98_1LE
2 Replies
Login or Register to Ask a Question