On Tue, Feb 11, 2003 at 10:46:58AM -0800, Randal L. Schwartz wrote: > The following message is a courtesy copy of an article > that has been posted to perl.qa as well. > > >>>>> "Vlad" == Vlad Harchev <[EMAIL PROTECTED]> writes: > > Vlad> I'm testing some perl source code transformation tool (kinda > Vlad> perl source code prettifier). > > If you'll allow me access to your source, I can guarantee you to be > able to write some code that will break upon your transformation.
Currently I can't afford this, sorry. > There's no way to perfectly parse Perl (thanks to prototypes). This is not a problem in my case. In my case the biggest problem is unusual handling of whitespaces in the perl. E.g. the following gives syntax error for perl-5.6.1: ####quote begin sub f( $ $ ) { print "a"; }; ####quote end while this doesn't: ####quote begin sub f( $ $ ) { print "a"; }; ####quote end The following functions act different due to features of perl parser: sub f { { "blah" , 2}; }; sub g { { "blah", 2}; }; - f() returns integer 2, g() returns reference to anonymous hash - though the difference is only in amount of whitespace (whether there is a newline after "blah"). I found a lot of cases when adding newline and/or space in the function body makes the code treated as synaxically incorrect. That's the biggest problem I encounter. Dunno, may be I should forward these my notes to some perl mailing list (which one then?).. > The question you probably want answered instead is "what is the > likelyhood of that character sequence occurring in *production code?", > correct? Yes, but extensive testing won't hurt. > But, if you want me to break it, let me know. Thank you for the offer, I will try it myself first :) -- Best regards, -Vlad