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.
In reply to Source-Code Analysis? by monsieur_champs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |