This is more of a handy how-to than it is a question. A permanent
'howto' as it were.

A Perl project I'm working on contains 457 functions (ie. subroutines
(ie methods)), and even though I have documentation for all of them,
sometimes it is handy to have a list in front of me.

This is how I produce the list of all sub-routines within all module
files, which includes the module name and sub.

% grep -E -r "sub \w+ {" * | grep -v svn | awk '{FS=":"} \
{print $1, " ", $2}' | awk '{FS=" "} {print $1, " ", $3}'

...adapted to pull subs from a single file:

% cat lib/ISP/User.pm | grep -E "sub \w+ {" | awk '{print $2}'

For efficiency, and so I can remember more readily, my request is for
golf, particularly adaption to a Perl one-liner ;)

Cheers,

Steve

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to