SPUG: extracting functions

Damian Conway damian at cs.monash.edu.au
Thu Apr 13 18:46:22 CDT 2000


Hi Todd,

You asked:

   > 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... 
   > ...and be smart enough to end at the correct bracket.
   >
   > 
   > Maybe one of you could point me in the right direction?  

Check out Text::Balanced, specifically the extract_codeblock subroutine.

Damian

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     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