Today I was checking some code running
perl -c when it core dumped on me. Upon investigation the culprit was a buggy DESTROY subroutine well outside of any BEGIN or CHECK block that I could see.
That got me thinking. What particularly concerned me was that this bit of buggy code was making system calls - nothing huge in this particular case, but it got me thinking about what else could have been in that routine. I think most people consider syntax checking a "safe" operation, but if anything can be done and anything can be invoked indirectly from within a BEGIN or CHECK block, that isn't quite true? is it?
So my question (ok questions) are:
- What code other than the BEGIN {} and CHECK {} blocks get executed, and under what conditions? - the Perl documentation only indicates that those two blocks get executed.
- What restrictions are there on the kinds of code executed during the syntax check mode? How does taint mode behave? Does it? Are there other restrictions?
- And if there are none, e.g. anything can be called, is this safe? What precautions do people use to make sure that code (especially someone else's code) is safe to syntax check?
Many thanks in advance, beth
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.