monsieur_champs has asked for the wisdom of the Perl Monks concerning the following question:
Oh Wise Fellows-in-Perl Today I've spent my day thinking about an old and dull problem I have at work: how to analyse and solve dependency problems with legacy source code? I mean, I need to remove old, not used anymore, libraries and references to templates, config options and the like from my source code. Its not huge at all, but I don't want to search for every reference by hand.
My question is: is there any (?:tool|library|program) that could be useful for accomplish this task? I don't even know how to name this job, so I just can't find anything usefull at google or at Seekers of Perl Wisdom.
Please, no ready answers, I need to figure things out by myself, and maybe roll my own solution out-of-the-box. Pointers, libraries, example source code and ideas are all welcome.
Ah! This is something I've coded (sorry, Bourne Again Shell, not Perl) as a proof-of-concept...:
#!/bin/bash function search-for-dependants () { pushd "$1" || exit 1 for template in `find . -type f -print | egrep -v CVS | sed 's/^\.\/ +//;'` do remove=$template if echo $template | egrep -q '\.pm$'; then template=$(echo $template | sed 's/^.*\/lib\///;s/\//::/g;s/\.pm +$//;') fi echo "========================================" echo $template echo "========================================" find ~/src/netfax \ -type f \( -exec egrep -q $template "{}" \; -a -print \) | egrep -v CVS | egrep -v $remove | sort -u echo -e "========================================\n\n" done | sed 's/^\/home\/lcampos\/src\/netfax\///;' | tee ~/tmp/files popd } search-for-dependants ~/src/netfax/components search-for-dependants ~/src/netfax/lib
Update: minor spelling error fixes.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Source-Code Analysis?
by fglock (Vicar) on May 17, 2004 at 20:42 UTC | |
by DrHyde (Prior) on May 18, 2004 at 07:46 UTC | |
|
Re: Source-Code Analysis?
by Rex(Wrecks) (Curate) on May 17, 2004 at 21:04 UTC | |
by PodMaster (Abbot) on May 18, 2004 at 03:42 UTC | |
by andyf (Pilgrim) on May 19, 2004 at 13:24 UTC | |
|
Re: Source-Code Analysis?
by fletcher_the_dog (Friar) on May 17, 2004 at 22:05 UTC | |
by rjray (Chaplain) on May 17, 2004 at 23:21 UTC | |
by drewbie (Chaplain) on May 18, 2004 at 00:24 UTC | |
by rjray (Chaplain) on May 18, 2004 at 00:27 UTC | |
by drewbie (Chaplain) on May 18, 2004 at 20:53 UTC | |
| |
|
Re: Source-Code Analysis?
by graff (Chancellor) on May 18, 2004 at 04:35 UTC | |
|
Re: Source-Code Analysis?
by periapt (Hermit) on May 18, 2004 at 12:33 UTC |