SPUG: extracting functions
Todd Wells
toddw at wrq.com
Thu Apr 13 15:14:16 CDT 2000
Hi, I want to write a perl program that will parse my existing perl programs
and alphabetize the functions.
I think have a pretty good handle on how I can do this conceptually, but I'm
not sure how I would go about getting all of one function into a string.
I imagine something like this, but I'm not sure how to deal with nested
curly braces...
$myfunc =~ /(^sub\w+{.+?})/m;
I know this isn't what I want, this would probably grab my first "sub
whatever {" through the last "}" in the program.
I need it to be able to get all of a function like this...
sub myfunk {
if ($maybe) {
# do this
} else {
# do that
}
}
...and be smart enough to end at the correct bracket.
Maybe one of you could point me in the right direction?
-Todd
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
SUBSCRIBE/UNSUBSCRIBE: Replace "action" below by subscribe or unsubscribe
Email to majordomo at pm.org: "action" spug-list your_address
More information about the spug-list
mailing list