SPUG: parsing Perl from Perl...

dancerboy dancerboy at strangelight.com
Tue Nov 6 22:32:04 CST 2001


So, I have a few applications in which I need to parse (but *not* 
compile or execute) Perl code.  With all of Perl's built-in features 
for self-reflection, I would have thought that there would be a 
module that did this, but I can't seem to find one.

If necessary, of course, it wouldn't be that difficult simply to code 
a Perl parser from scratch, using regexp's and event streams and all 
the rest of it... but I'm trying not to reinvent the wheel here.

I kind of get this feeling that I'm missing something obvious here.

Any suggestions?

-jason

P.S.  Since it might not be exactly clear what I mean by "parsing", 
let me give a couple of examples of the sorts of applications I mean.

1.  A syntax-coloring script, that turns Perl source into syntax-colored HTML.

2.  A pre-processor that enforces slightly stricter syntax than that 
of the normal Perl compiler. (Specifically, not allowing named 
subroutines to be defined inside blocks of code.)

And other stuff along those lines...

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/





More information about the spug-list mailing list