I say the most important thing about learning Perl's insides is using a C compiler to produce post preprocessor output then running that through a code formatter. Perl uses so many macros, and macros made of macros made of macros, that it is impossible to see what is actually done on a C or assembly level using a C debugger on the Perl engine. The perl stack grows up (higher pointers), the x86 stack grows down (lower pointers). YACC (the parser library in Perl, and some other programing languages) is supposedly C code, but its practically a different programing language, that through the magic of the preprocessor becomes C code. Use EXTEND(), not XPUSH* to reduce bloat. Try to never use malloced memory, it will leak when you croak/die, instead make a mortal SV and grow it, you dont need to ever make Pok or expose it in the Perl language or save it in a Perl engine struct. For XS, use memory from SV that came from @_ (Perl stack) or package glob globals. Remember you can access trees of hashes and blessed hash objects in XS as easily as you can in Perl. Good use of the Alias feature can reduce alot of XS bloat. XPrePUSH and PUSHs are less bloated than XS_RETURN*. Use PPCODE: not CODE: in xsubpp processed XS libraries. To look at a SV in C, read my node here
Looking at a SV in C.
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.