perlmeditation
japhy
[sierrathedog04] was [id://95902|baffled] recently about me saying I was going to patch Perl. Allow me to shed some light on the subject.
<br><br>
To patch Perl, you don't need to know very much C -- rather, you need to know a lot of perl. No, not Perl, but perl. The code for perl is written in C, and there are more macros in the code than you can imagine. I've never done any <i>really</i> involving work with the perl source code, but I plan to in the future.
<br><br>
The problem I worked on most recently was putting a warning around the use of the <tt>/o</tt> modifier with a <tt>qr//</tt> object. There were several places that needed patching:
<ul>
<li> <i>toke.c</i> - adding code to alert "Useless use of /o modifier" in the <tt>S_scan_pat()</tt> function
<li> <i>pod/perldiag.pod</i> - adding extended information about the warning (raised when <tt>use warnings 'syntax'</tt> is active
<li> <i>pod/perlop.pod</i> - adding information about the uselessness of <tt>qr//o</tt>
<li> <i>t/warn/toke</i> - adding tests to make sure the warning is raised
</ul>
Only a little bit of actual C code was required. The rest, though, is just as important. The only reason Perl is documented as much as it is, is because <i>real people</i> have spent time documenting it. When Perl changes, the documentation must change. Tests must be created to ensure the change works as expected, and doesn't break other things.
<br><br>
As for submitting the patch, P5P (the Perl5-Porters) prefer patches in "universal diff" format (<tt>diff -u OLD NEW</tt>). After submitting my patch to <i>perl5-porters@perl.org</i>, feedback comes in about something that I may not have handled correctly, or suggesting a different course of action. Finally, after things work and people are happy, Jarkko, the Perl Patch Pumpking, lets me know that my patch has been "applied, thanks."
<br><br>
What Perl did I patch? The most recent "snapshot" of version 5.7.1, also known as "bleadperl". This is the development branch of Perl 5.6.1, indicated by the odd number. (When Perl 5.8 comes out, development will occur in 5.9.)
<br><br>
For more information, read the <i>perlhack.pod</i> documentation, found in the Perl 5.6 docs.
<br><br>
<tt><font color="#0000ff">japhy</font></tt> --
<a href="/index.pl?node=japhy&lastnode_id=1072">Perl and Regex Hacker</a>