in reply to Recognizing Perl in text
(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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Recognizing Perl in text
by DrHyde (Prior) on Jan 06, 2011 at 10:25 UTC | |
by LanX (Saint) on Jan 06, 2011 at 12:28 UTC | |
by girarde (Hermit) on Jan 06, 2011 at 20:12 UTC | |
by DrHyde (Prior) on Jan 07, 2011 at 10:27 UTC | |
by LanX (Saint) on Jan 07, 2011 at 14:28 UTC | |
|
Re^2: Recognizing Perl in text
by Anonyrnous Monk (Hermit) on Jan 06, 2011 at 13:47 UTC | |
by LanX (Saint) on Jan 06, 2011 at 15:21 UTC | |
by LanX (Saint) on Jan 06, 2011 at 14:48 UTC | |
|
Re^2: Recognizing Perl in text
by Anonymous Monk on Jan 06, 2011 at 17:29 UTC | |
by LanX (Saint) on Jan 06, 2011 at 18:53 UTC |