On 5/25/05, Deborah Pickett <[EMAIL PROTECTED]> wrote: > I'm afraid that because of the dynamic parse/execute nature of Perl, it > may be a theoretically intractable problem to parse Perl safely.
Yep. It's not really possible for the parser to distinguish between: BEGIN { %main::{'&foo'} = sub { print "Hello!" }; } And: BEGIN { for 1... {} } Or even: BEGIN { system 'rm -rf /' } So, like most things in Perl, we can trust the author of the code not to do such things, or we can not trust them and lose something while we're at it (the choice is given to the IDE user, not to us designers). BEGIN blocks should never do INITialization, opening filehandles, etc., precisely for this reason. This becomes even more important in Perl 6 where bytecode will be more prevelant. You may certainly parse Perl syntax trees without executing BEGIN blocks, but you have to bite the bullet if the BEGIN changes the syntax in a way that you can no longer parse it if you don't execute it. And if you can't accept that, I see only one option: give up BEGIN blocks. And we're not going to do that (but you're free to place that restriction on whoever's code you're parsing). Luke