(I suppose man pages don't include syntactically wrong code).
Anyway you'll run into security issues, because avoiding the execution of BEGIN blocks isn't trivial.
(see Vulnerabilities when editing untrusted code... (Komodo) and especially 847484)
Another option then should be using PPI for a static parse
Cheers Rolf
UPDATE: If you say "analyze a man page" do you mean generated from POD (as IMHO >90% of all mans about Perl should be)? POD has a pretty clear convention to signal embedded code by indentation.
Best solution anyway would be to parse the original POD instead of the man page, some POD parser (like POD::POM )already allow recognizing code sections (but which are not necessarily Perl-code).
If you now run a syntax check on those extracted chunks you should get almost 100% secure results.
In reply to Re: Recognizing Perl in text
by LanX
in thread Recognizing Perl in text
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |